hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.74k stars 9.1k forks source link

[Bug]: aws_acm_certificate does not return resource_record_value values #33559

Open raghavanrrs opened 11 months ago

raghavanrrs commented 11 months ago

Terraform Core Version

v1.5.6

AWS Provider Version

v5.17.0

Affected Resource(s)

aws_acm_certificate

Expected Behavior

Should return resource_record_value as CNAME as before

Actual Behavior

expected type to be one of ["SOA" "A" "TXT" "NS" "CNAME" "MX" "NAPTR" "PTR" "SRV" "SPF" "AAAA" "CAA" "DS"], got  ""

Relevant Error/Panic Output Snippet

expected type to be one of ["SOA" "A" "TXT" "NS" "CNAME" "MX" "NAPTR" "PTR" "SRV" "SPF" "AAAA" "CAA" "DS"], got  ""

Terraform Configuration Files

resource "aws_route53_record" "cert_validation" {
  for_each = {
    for dvo in aws_acm_certificate.certificate.domain_validation_options : dvo.domain_name => {
      name    = dvo.resource_record_name
      record  = dvo.resource_record_value
      type    = dvo.resource_record_type
      zone_id = var.zone_id
    }
  }

  allow_overwrite = var.allow_overwrite

  name    = each.value.name
  type    = each.value.type
  zone_id = each.value.zone_id
  records = [each.value.record]
  ttl     = 300
}

Steps to Reproduce

resource "aws_acm_certificate" "certificate" {
  domain_name               = var.domain_name
  validation_method         = "DNS"
  subject_alternative_names = var.subject_alternative_names

  tags = var.tags

  lifecycle {
    create_before_destroy = true
  }

  options {
    certificate_transparency_logging_preference = var.certificate_transparency_logging_preference ? "ENABLED" : "DISABLED"
  }
}

resource "aws_route53_record" "cert_validation" {
  for_each = {
    for dvo in aws_acm_certificate.certificate.domain_validation_options : dvo.domain_name => {
      name    = dvo.resource_record_name
      record  = dvo.resource_record_value
      type    = dvo.resource_record_type
      zone_id = var.zone_id
    }
  }

  allow_overwrite = var.allow_overwrite

  name    = each.value.name
  type    = each.value.type
  zone_id = each.value.zone_id
  records = [each.value.record]
  ttl     = 300
}

Debug Output

expected type to be one of ["SOA" "A" "TXT" "NS" "CNAME" "MX" "NAPTR" "PTR" "SRV" "SPF" "AAAA" "CAA" "DS"], got  ""

Panic Output

expected type to be one of ["SOA" "A" "TXT" "NS" "CNAME" "MX" "NAPTR" "PTR" "SRV" "SPF" "AAAA" "CAA" "DS"], got  ""

Important Factoids

when output acm cert, we are getting

"resource_record_type" = ""

References

image (8)

Would you like to implement a fix?

None

github-actions[bot] commented 11 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue