How do I run a fargate task once, built from a pul...
# general
b
How do I run a fargate task once, built from a pulumi stack, preferably within or close to the pulumi stack script I want to create a task definition for fargate, and run the task once. The purpose is to run a custom build script on a build server using a custom image built in an awsx.ecs.Image. awsx.ecs.FargateTaskDefinition#run() complains that it can't run the task during a preview or a get. This makes sense to me, as it would need to wait until the task was created, including all it's dependencies. I can see several ways to run the task once its created using aws scripts or a enclosing script or <?>. I am interested in getting advice on what the preferred way to execute a fargate task like this would be.
Copy code
error: Running program '/mnt/e/Development/apps/inside-v-next/ivn-build/ivn-build-stack' failed with an unhandled exception:
    Error: Cannot call '.get' during update or preview.
s
I, too, would love to find a good way to do this. Because I had too many caveats involved -- e.g. run the task ONLY after all other associated tasks had started and stablized completely (which could happen AFTER the pulumi update completed) we ended up resorting to doing this manually -- an AWS API endpoint gets created via
httpthing = new cloud.API
, auth defined via a bearer token passed in as a header, and then setting up
<http://httpthing.post|httpthing.post>(...
so that it would run the
new cloud.Task
item which had been created.