Open ghost opened 6 years ago
:+1: Any news on this ? Curious if anyone has any workaround? It's really cumbersome to have to manually login to the UI, remove suspend policies, and then re-destroy.
Just chiming in that I am also running into this issue. My organization uses Cloud Custodian to save on AWS costs. One of these policies will suspend our ASGs during the off hours. This means that if someone runs terraform destroy during off_hours, it will fail to complete.
Presumably a workaround is to use force_delete
in the ASG terraform resource definition, but that would leave dangling stopped EC2 instances that will get restarted by Cloud Custodian when it's no longer in off_hours and it is ready to resume resources.
Did you try increasing the timeout
for the ASG when it is destroyed , something like
resource "aws_db_instance" "example" {
# ...
timeouts {
create = "60m"
delete = "2h"
}
}
In my case the ASG takes more than 10 mins to get destroyed , so it times out since the default value is 10m
. I will suggest giving the timeout
option on aws_autoscaling_group
a spin 🙃
make sure the the iam_instance_profile referenced on the Launch template
have the necessary policies for autoscaling.
e.g. autoscaling:*
This issue was originally opened by @TTEA1990 as hashicorp/terraform#18502. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform Configuration Files
Debug Output
Crash Output
Expected Behavior
Terraform sest Min/max/desired instances to 0 but the associated EC2 instances are not terminated. Terraform waits for resorce to be destroyed until it hits is 10 minute timeout
Steps to Reproduce
Create aws_launch_configuration and aws_autoscaling_group resource with the following attributes
resource "aws_autoscaling_group" "fes_asg" {
name = "TEST-ASG-001" min_size = "2" max_size = "2" desired_capacity = "2" launch_configuration = "${aws_launch_configuration.test_lc.name" suspended_processes = ["Launch", "Terminate", "HealthCheck", "ReplaceUnhealthy", "AZRebalance", "AlarmNotification", "ScheduledActions", "AddToLoadBalancer"] }