Closed sidekick-eimantas closed 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Hey @sidekick-eimantas 👋 Thank you for taking the time to raise this! Terraform itself is responsible for generating the graph that determines order of operations, and doesn't currently have a way for providers to supply additional information regarding ordering. That said, you can control this to some degree with create_before_destroy
(this issue in the Terraform Core repository has quite a bit more information that I found helpful when brushing up on this particular pattern).
Given the info above, I'll close this one out. If you feel I've done this in error, please do let me know.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Core Version
1.5.2
AWS Provider Version
5.7.0
Affected Resource(s)
Expected Behavior
Distribution ordered_cache_behavior should be removed first, before the destruction of aws_cloudfront_origin_request_policy and aws_cloudfront_cache_policy
Actual Behavior
Terraform tried to destroy aws_cloudfront_cache_policy and aws_cloudfront_origin_request_policy first before removing an ordered_cache_behavior from the distribution, causing the apply to fail, because cache and request policies referenced to by cache behaviors, cannot be deleted.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
The config files involved are massive. Let me know if they're required to reproduce this and I'll spend some time putting together a minified example.
Steps to Reproduce
terraform apply
Debug Output
No response
Panic Output
No response
Important Factoids
I'm not sure whether this is caused by how the module we're using is written, by this provider or by terraform itself, but it seems that the order of operations is incorrect.
Using -target to try and force terraform to remove the cloudfront cache behavior first had no effect.
References
No response
Would you like to implement a fix?
None