hashicorp/terraform

Feature request: wait_for_termination_timeout for aws_autoscaling_group

brikis98 opened this issue · 3 comments

The aws_autoscaling_group resource allows you to specify a wait_for_capacity_timeout parameter to control how long Terraform will wait for ASG instances to transition to the "In Service" state before timing out.

Is it possible to expose an analogous wait_for_termination_timeout parameter that controls how long Terraform will wait for ASG instances to terminate when deleting an ASG?

The use case is that I've added an aws_autoscaling_lifecycle_hook for autoscaling:EC2_INSTANCE_TERMINATING, and sometimes it takes a while to do processing before I can mark the hook as complete and allow the instance to terminate. Unfortunately, it looks like there is a hard-coded 10 minute timeout somewhere in the Terraform code, as after 10 minutes, I get the error:

* aws_autoscaling_group.autoscaling_group (deposed #0): group still has 3 instances

By default, the instance remains in a wait state for one hour, and then Auto Scaling continues the launch or terminate process (Pending:Proceed or Terminating:Proceed). If you need more time, you can restart the timeout period by recording a heartbeat. If you finish before the timeout period ends, you can complete the lifecycle action, which continues the launch or termination process.

Yes, the issue is here. I'll put up a PR to implement the feature.

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.