-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destroying some Cloudfront certificates fail on first attempt #18997
Comments
This issue has been automatically migrated to hashicorp/terraform-provider-aws#6082 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#6082. |
+1 on this I think the cause of this issue is, cloudfront (or api gateway) resource in Terraform in general depends on acm certificates to be destroyed first. However, on AWS, you cannot delete a certificate when it is in use (by cloudfront, for example). So this potentially this creates a circular dependency that Terraform is not aware of. In other words:
While in reality, Terraform might be doing only the last 2 steps:
I'm not sure if this is a problem that needs to be solved on the Terraform side or AWS provider side.. |
By the way, the reason why I made this guess is, through my experiment, after Terraform returns error of certificate in use, I went to checked the custom domain settings in my API Gateway resource and noticed that it is still set to the certificate to be destroyed, which means terraform didn't set it before destroying the certificate to release the lock. |
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. |
When I run a terraform destroy I get the error below:
If I run it again it deletes them properly:
There are other modules with acm certificates that get deleted on the first go but for some reason the two above need terraform destroy to be run twice. The code for the acm certs is pretty much the same, but these are the only two certs used for API GWs:
Terraform and AWS providers are at the latest versions:
How can I troubleshoot this further? Many thanks.
PS. I am aware of this one (which sounds exactly the same as my problem) --> hashicorp/terraform-provider-aws#3866
But as mentioned above I am on newer versions and instead of ELBs the certs are used with API GWs.
Cheers.
The text was updated successfully, but these errors were encountered: