Difference between revisions of "Terraform Apply Fail"
Jump to navigation
Jump to search
(Created page with "# Partial failed terraform apply If terraform fails part way though and is left in inconsistent state even after you fix issues you might get resource already exists with th...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
# Partial failed terraform apply | # Partial failed terraform apply | ||
− | If terraform fails part way though and is left in inconsistent state even after you fix issues you might get | + | If terraform fails part way though and is left in inconsistent state even after you fix issues you might get: |
+ | |||
+ | - Resource already exists with that name even though created because didn't save in state file. | ||
+ | - Duplicate copies for resources that don’t enforce unique identities. | ||
+ | |||
+ | Fix | ||
- Manually find everything that got deployed, delete it, and re-run terraform apply. | - Manually find everything that got deployed, delete it, and re-run terraform apply. | ||
- Manually find everything that got deployed, and for each such resource, run terraform import 41. | - Manually find everything that got deployed, and for each such resource, run terraform import 41. | ||
− | + | ## Refs | |
- https://github.com/hashicorp/terraform/issues/20718 | - https://github.com/hashicorp/terraform/issues/20718 | ||
+ | - https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa | ||
+ | - https://medium.com/@karthikeyan_krishnaswamy/terraform-state-eea807cc00ba | ||
+ | - https://stackoverflow.com/questions/61418168/terraform-resource-with-the-id-already-exists |
Latest revision as of 17:19, 4 October 2021
Partial failed terraform apply
If terraform fails part way though and is left in inconsistent state even after you fix issues you might get:
- Resource already exists with that name even though created because didn't save in state file.
- Duplicate copies for resources that don’t enforce unique identities.
Fix
- Manually find everything that got deployed, delete it, and re-run terraform apply.
- Manually find everything that got deployed, and for each such resource, run terraform import 41.