Terraform Destroy : Dependency between ASG-->CWEvent-->Lambda #913
Labels
question
A question about existing functionality; most questions are re-routed to discuss.hashicorp.com.
service/autoscaling
Issues and PRs that pertain to the autoscaling service.
service/lambda
Issues and PRs that pertain to the lambda service.
This issue was originally opened by @rashcuva as hashicorp/terraform#15320. It was migrated here as part of the provider split. The original body of the issue is below.
Team,
I have created a Lambda function to perform insert and delete whenever ASG scales out or scales-in.
The Lambda updates the tags so that all instances are unique and also adds a unique entry in the route 53 table.
ASG events triggers CW Event(s) which in turn triggers Lambda.
When I destroy my environment using "Terraform Destroy", my CW event rule gets deleted much faster than ASG group. Even if ASG alerts Cloudwatch, the event rule is already deleted by then. Hence my Lambda to delete Route53 never gets triggered.
How do I add some kind of dependency here to let Lambda trigger before "destroy is complete"?
I have tried my bits with hooks and some adhoc scripting but cant make it work.
Could you please guide in the right direction.
PS : I know it is not an issue but am not able to get much help on this otherwise.
The text was updated successfully, but these errors were encountered: