https://pulumi.com logo
Title
g

gray-belgium-81846

07/11/2021, 6:31 PM
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:
taskDefinition.run({cluster})
However, when I run
pulumi up
I get:
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

many-yak-61188

07/11/2021, 6:56 PM
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

gray-belgium-81846

07/11/2021, 7:07 PM
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