-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 #6082
Comments
Not sure if the answer is too obvious or too difficult? :-) Would be good to have some feedback on this, thanks! |
+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. |
Facing the same issue. Any update on mitigating this? |
This issue is still plaguing me, any chance this has been fixed? My terraform destroy command cannot destroy my cloudfront distribution that is using a aws_acm_certificate, because the certificate does not get destroyed either... halp meh =( |
Can we get some traction on this? The current timeout on destroy is 10 minutes but the average time for a cert to become aware that it is no longer in use by an API Gateway Custom Domain is ~15 minutes. Adjusting the timeout to 20 minutes seems reasonable and sufficient. Or giving the ability to adjust the timeouts on this particular resource would also suffice. |
Reference: #3855 Reference: #6082 Reference: #8755 Reference: #12075 Reference: #13053 Notable changes: ``` ENHANCEMENTS: * resource/aws_acm_certificate: Add `status` attribute BUG FIXES: * resource/aws_acm_certificate: Detect `AMAZON_ISSUED` type `validation_method` value directly from API response instead of custom logic * resource/aws_acm_certificate: Increase deletion retries from 10 minutes to 20 minutes (better support API Gateway Custom Domain deletion) ``` Other changes: - Documents `subject_alternative_names` argument removal procedures - Improves potentially confusing error message during asynchronous ACM validation assignment Output from acceptance testing: ``` --- PASS: TestAccAWSAcmCertificate_imported_IpAddress (36.64s) --- PASS: TestAccAWSAcmCertificate_root_TrailingPeriod (37.74s) --- PASS: TestAccAWSAcmCertificate_wildcard (38.86s) --- PASS: TestAccAWSAcmCertificate_wildcardAndRootSan (39.08s) --- PASS: TestAccAWSAcmCertificate_emailValidation (39.11s) --- PASS: TestAccAWSAcmCertificate_dnsValidation (39.35s) --- PASS: TestAccAWSAcmCertificate_rootAndWildcardSan (39.62s) --- PASS: TestAccAWSAcmCertificate_disableCTLogging (41.62s) --- PASS: TestAccAWSAcmCertificate_san_single (41.93s) --- PASS: TestAccAWSAcmCertificate_san_TrailingPeriod (42.00s) --- PASS: TestAccAWSAcmCertificate_san_multiple (42.05s) --- PASS: TestAccAWSAcmCertificate_root (42.07s) --- PASS: TestAccAWSAcmCertificate_privateCert (47.46s) --- PASS: TestAccAWSAcmCertificate_imported_DomainName (54.51s) --- PASS: TestAccAWSAcmCertificate_tags (85.67s) ```
The deletion retry timeout has been increased to 20 minutes to better account for this type of ACM Certificate usage where infrastructure deletion does not provide deletion status information (e.g. Cognito User Cool Custom Domains). This will release with version 2.65.0 of the Terraform AWS Provider, likely later today. 👍 |
This has been released in version 2.65.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @ophintor as hashicorp/terraform#18997. It was migrated here as a result of the provider split. The original body of the issue is below.
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) --> #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: