-
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
aws_acm_certificate "completes" too soon with incorrect state #9840
Comments
I'm also still experiencing this with provider v2.25.0. This sounds like it was supposed to be fixed in v2.23.0 with #9598, but I can't get anything to work. |
I'm also still experiencing this with provider v2.26.0 |
I'm also having this issue with provider v2.26.0. |
Me too |
I've had a similar issue, but didn't bother to try to execute If you've not done that already, it is as simple as filing a support ticket for Certificate manager, Whitelisting domain. Just mention which one there. It might not be needed to wait for the Support response. In my case, they've acted much faster than responding in the ticket. Just try from time to time. Other symptoms of this issue:
I've first experienced this issue in NEW account around Feb-March 2019. Since this issue is created in August - whitelisting could be the case. Yesterday it happened for me in an old account, which already had this for a few years: imported wildcard cert, delegated DNS zone, many and frequently changing DNS records for the domain. I was naive to think this whitelisting stuff will not affect grandfathered accounts. Additional info from AWS Support:
|
Having something very similar on 2.47 - my difference being that I'm updating an existing certificate resource to have a new SAN, so the "Invalid index" references the previous count of domain_validation_options as it has the old state. It feels like there needs to be a check before this return statement after the certificate is requested that makes sure the "complete" resource is returned, with the expected fields, with a suitable retry on it: https://github.com/terraform-providers/terraform-provider-aws/blob/b7592c0b08b8ed2021ae35d32b6a3b655e09ef5d/aws/resource_aws_acm_certificate.go#L210-L219 |
I'm encountering the same issue when I try to add a domain to
I get a
|
Also experiencing this with creating aws ACM cert with SANS, i've had to previously work around by creating the cert first then uncommenting my SAN validation and rerunning it. I've even tried adding some What is the proper approach here?
Error: Invalid index on certificates.tf line 23, in resource "aws_route53_record" "app_cert_validation_san": The given key does not identify an element in this collection value. |
I think I might have discovered a temporary fix using Terraform's Is this a viable fix until the redesign is finished, or are there any critical gotcha's I should be aware of here? # module/main.tf
locals {
# var.domain_zones = {
# "domain.com" = "<hosted-zone-id>"
# "domain.net" = "<hosted-zone-id>"
# "my.domain.com" = "<hosted-zone-id>"
# }
domains = sort(keys(var.domain_zones))
validation_options_by_domain_name = {
for opt in aws_acm_certificate.cert_website.domain_validation_options : opt.domain_name => merge(opt, {
# Fallback value will be used when domain_validation_options references
# a domain_name that has been removed from var.domain_zones
zone_id = lookup(var.domain_zones, opt.domain_name, keys(var.domain_zones)[0])
})
}
}
resource "aws_acm_certificate" "this" {
domain_name = local.domains[0]
validation_method = "DNS"
subject_alternative_names = slice(local.domains, 1, length(local.domains))
lifecycle {
create_before_destroy = true
}
}
resource "aws_route53_record" "this" {
# Fallback values will be used when domain_validation_options is not up-to-date
depends_on = [aws_acm_certificate.cert_website]
for_each = var.domain_zones
name = lookup(local.validation_options_by_domain_name, each.key, values(local.validation_options_by_domain_name)[0]).resource_record_name
type = lookup(local.validation_options_by_domain_name, each.key, values(local.validation_options_by_domain_name)[0]).resource_record_type
zone_id = lookup(local.validation_options_by_domain_name, each.key, values(local.validation_options_by_domain_name)[0]).zone_id
records = [lookup(local.validation_options_by_domain_name, each.key, values(local.validation_options_by_domain_name)[0]).resource_record_value]
ttl = 60
allow_overwrite = true
} |
Thanks @stekern, I was able to use your method with a cloudflare record:
|
Hi all 👋 Thank you for the continued discussion here! Given that the last update was quite a while ago, can anyone verify whether you're still experiencing this issue on a more recent version of the AWS Provider? |
Hi all 👋 Since we haven't heard back in a bit, it sounds like this may have been fixed in the time since the last report, so I'm going to close this issue out. If anyone experiences this again in the future, please feel free to open a new issue and reference this one for additional context. |
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. |
Community Note
Terraform Version
$ terraform -v
Terraform v0.12.6
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Apply successfully
Actual Behavior
Result of apply
Terraform state after apply
Terraform state after refresh
Steps to Reproduce
terraform apply
terraform state show aws_acm_certificate.my_cert
terraform refresh --target aws_acm_certificate.my_cert
terraform state show aws_acm_certificate.my_cert
References
The text was updated successfully, but these errors were encountered: