Asking this again since it got no response, I need my pulumi project to stop the current task running on an EC2 service at ECS before it tries to set up a new task using the latest revision, is there a way to do that? deleteBeforeReplace on the service/taskDefinition does not seem to work, thanks!
02/06/2023, 2:55 AM
Starting and stopping tasks isn't really what Pulumi is designed to do. It's for creating infrastructure. A task is considered infrastructure, so it'll create a task, but it won't stop or start it.
You can use the AWS SDK for that. And since Pulumi programs are normal programs, you can call the SDK from within your Pulumi program. You do need to remember that your code does not run imperatively: when you say "create a new task". Pulumi makes note of the requirement for a new task, and will create it at some later time.