Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait until ECS deployment is complete? #3107

Closed
bitbrain opened this issue Jan 23, 2018 · 12 comments · Fixed by #3485
Closed

Wait until ECS deployment is complete? #3107

bitbrain opened this issue Jan 23, 2018 · 12 comments · Fixed by #3485
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.
Milestone

Comments

@bitbrain
Copy link

Hello,

I have Terraform scripts which setup the following resources:

  • Autoscaling Group
  • Launch Configuration
  • Application Load Balancer
  • ECS cluster
  • Service
  • Task definition
  • ECR repository

When I run the script, those resources get provisioned accordingly. However, when I want to update/deploy a service, is there a way to tell Terraform to wait until a health check is okay? (like in Elastic Beanstalk Deployments)

Right now, it will complete the terraform apply command, even if the service for some reason is unable to spawn new tasks into the cluster.

@bflad bflad added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/ecs Issues and PRs that pertain to the ecs service. labels Jan 23, 2018
@scream314
Copy link
Contributor

@bitbrain
AFAIK there is no such option for ECS.
I do not think it would be a good idea to handle this in Terraform as it can happen that the deployment is broken and the health check will never be okay.
I think this should be handled by the thing (script, your hand, CI, etc. ) invoking Terraform and wait until the service is successfully deployed.

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. labels Nov 13, 2018
@marcotesch
Copy link
Contributor

I totaly agree with @scream314,

As of now CloudFormation has this feature and it is annoying when Infrastructure as Code interferes with your Container Scheduling Engine, in this case ECS. This would make your Terraform deployments in the worst case blocking/deadlocking. As you can't automatically recover from a non working ECS deployment, when it waits for the ECS service to reach a steady state.

@bitbrain
Copy link
Author

Update: there is actually a service-stable command for ECS to wait for a service to become stable: you can use that for example within a null_resource to wait for a service to deploy successfully with good health:

https://docs.aws.amazon.com/cli/latest/reference/ecs/wait/services-stable.html

@ewbankkit
Copy link
Contributor

Is this the same as #10149?

@ChristophP
Copy link

thanks for the tipp @bitbrain . Works like a charm.

@richardgavel
Copy link

While we could add the null_resource, it would be nice to mirror (as part of the ecs-service resource) the similar feature that is in the cloudfront distribution resource that will do a wait without the need for a null-resource . See #8116

@dekimsey
Copy link
Contributor

I feel this could be represented/handled via an ECS version of aws_acm_certificate_validation. That'd alleviate much of the issues that we run into in terms of simply not knowing if the new version successfully stabilized.

A psudedo resource such as aws_ecs_service_stable or the like.

@strowk
Copy link

strowk commented Jun 23, 2020

I think wait_stable on ecs resource would be better than doing the same in a separate resource. Shorter and makes sense.

@anGie44 anGie44 added this to the v3.13.0 milestone Oct 29, 2020
@anGie44
Copy link
Contributor

anGie44 commented Oct 29, 2020

This feature has been merged and will release with v3.13.0 of the Terraform AWS Provider, expected out later today. Thanks again @mmdriley for your contribution!

@dekimsey
Copy link
Contributor

I neglected to think of this earlier, but will this handle resource timeouts properly? Generally speaking for us at least if the service didn't start in 3m time, something is quite broken.

  timeouts {
    create = "3m"
    delete = "5m"
  }

@ghost
Copy link

ghost commented Oct 29, 2020

This has been released in version 3.13.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Nov 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants