https://pulumi.com logo
#typescript
Title
# typescript
b

breezy-butcher-78604

08/19/2020, 8:31 AM
I'm trying to create an
awsx.ecs.FargateTaskDefinition
using secrets that contain
Output<string>
however the underlying type -
aws.ecs.Secret
has properties that are
string
only. example code below:
Copy code
const secret = new aws.secretsmanager.Secret("my-secret", {});

const taskDefinition = new awsx.ecs.FargateTaskDefinition("my-task-definition", {
    executionRole: executionRole,
    logGroup: logGroup,
    container: {
        image: "my-image:latest",
        memory: 128,
        cpu: 512,
        portMappings: [{
            protocol: "tcp",
            containerPort: 8080,
        }],
        secrets: [
            { name: "MY_SECRET", valueFrom: secret.arn }
        ]
    }
});
this produces build errors since the
aws.ecs.Secret
type is defined as follows:
Copy code
interface Secret {
    name: string;
    valueFrom: string;
}
and
valueFrom
expects a string and not an
Output<string>
which is returned from
secret.arn
how can i coerce the types to allow this to work?
m

millions-furniture-75402

08/19/2020, 12:54 PM
I’ve used
// @ts-ignore
for cases like this.
l

little-cartoon-10569

08/19/2020, 8:52 PM
Does that work? I would expect the usual exception about calling
.toString()
on an Output..
b

breezy-butcher-78604

08/20/2020, 2:44 AM
if I just force a typecast the template appears to work fine, which i didn't expect. I would expect some kind of issues at some point?
💯 1