I’m trying to run a ‘fire and forget’ ECS Fargate ...
# aws
g
I’m trying to run a ‘fire and forget’ ECS Fargate task. The task starts a docker container which runs some database migrations and exits. I’m attempting to do something like:
Copy code
taskDefinition.run({cluster})
However, when I run
pulumi up
I get:
Copy code
error: Error: Cannot call '.get' during update or preview.
    To manipulate the value of this Output, use '.apply' instead.
        at Proxy.get (.../node_modules/@pulumi/pulumi/output.js:173:15)
        at FargateTaskDefinition.run (.../node_modules/@pulumi/ecs/taskDefinition.ts:229:39)
Any ideas? I think I need to wrap this is an async function somehow, but some guidance would be appreciated. The sample code shows this working in response to an API gateway handler, but I’d like it to execute when the pulumi program runs.
m
pulumi up
runs
preview
before confirmation which is why the error is occurring. going to guess taskdefinition is of type
Output
try using
apply
- https://www.pulumi.com/docs/intro/concepts/inputs-outputs/
g
yeah, that’s what I expected too. But the type of taskDefinition is
awsx.ecs.FargateTaskDefinition
. Somehow I need to create a new
Output
that defers the execution of the
taskDefinition.run