terraform-aws-fargate
terraform-aws-fargate copied to clipboard
Adding and Removing Services Causing Re-creation of all the resource
Hi,
Thanks for building this module, I am facing a similar issue described in the following link https://github.com/hashicorp/terraform/issues/17179
I think we should modify the existing code to use for_each
Hello @Sanyambansal76, thanks for reaching out.
Please, could you provide the version you're using and steps to reproduce?
What do you mean by "Re-creation of all the resource"?
I experience similar inconsistencies and an exhaustive re-creation of resources if I change anything inside a service. For me, this leads to unnecessary downtimes of the application when I upgrade the fargate declaration.
Maybe too many resources depend on something that is defined in a service, and thus it triggers recreation of those resources.
For example: Adding an acm_certificate_arn
to a service, should not cause the following changeset:
Plan: 22 to add, 1 to change, 21 to destroy.
------------------------------------------------------------------------
It event recreates the ECR repository, leading to the CodePipeline to fail, leading to new pushes being ignored, leading to a complete standstill.
@jlsan92 Sorry I was on vacation for last few days, I think it is happening because the resource and their state are uniquely identified by the index, not by their name, so if we change something in the order, hash calculated again and resources mismatched with hash index values and lead to the re-creation of resources. Following are the use-cases when hash recalculated for index
*We can add new rules only at the end of the hash. *We can remove rules only at the end of the hash. *We can modify the rules, as long as their position in the hash doesn't change. *But we can never remove any other rule or change their position in the hash.
Terraform Version - 0.12.12
I had re-written the whole module for my use-case if you want i can send a PR request next week.
@jlsan92 any update?
@Sanyambansal76 could you share this code in your own fork online so we can all benefit?