0
votes

How to destroy aws resource iam role AWSServiceRoleForAutoscaling in single terraform destroy?

Error: Error waiting for role (arn:aws:iam::012345678900:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling) to be deleted: unexpected state 'FAILED', wanted target 'SUCCEEDED'. last error: %!s()

In second terraform destroy, it destroys successfully.

1

1 Answers

1
votes

Is it being destroyed before AutoScaling group has a chance to be deleted, therefore throwing the error?

Maybe a depends on for the autoscaling group to depend on the iam role AWSServiceRoleForAutoscaling. (https://www.terraform.io/docs/language/meta-arguments/depends_on.html)

If that doesn't work then try to recreate with environment variable of TF_LOG set to a suitable value to debug (https://www.terraform.io/docs/internals/debugging.html)