terraform-provider-aws: `aws_acm_certificate_validation` wrongly reporting invalid `certificate_arn` on v4.12.0

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave β€œ+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

1.1.8, and the just-released v4.12.0

Affected Resource(s)

aws_acm_certificate_validation

Terraform Configuration Files

resource "aws_route53_zone" "test" {
  name = "some-zone."
}

resource "aws_acm_certificate" "test" {
  domain_name       = "*.some-zone"
  validation_method = "DNS"
}

resource "aws_route53_record" "test-a-record" {
  zone_id = aws_route53_zone.test.zone_id
  name    = aws_route53_zone.test.name
  type    = "A"
  alias {
    name                   = some_target_hostname
    zone_id                = lb_zone
    evaluate_target_health = true
  }
  
  lifecycle {
    ignore_changes = [records, ttl]
  }
}

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

  allow_overwrite = true
  name            = each.value.name
  records         = [each.value.record]
  ttl             = 60
  type            = each.value.type
  zone_id         = aws_route53_zone.test.zone_id
}

resource "aws_acm_certificate_validation" "test" {
  certificate_arn         = aws_acm_certificate.test.arn
  validation_record_fqdns = [for record in aws_route53_record.test : record.fqdn]
}

Expected Behavior

Terraform plan should have found no changes on my aws_acm_certificate_validation resource in this case.

Actual Behavior

image

Error: reading ACM Certificate (2022-04-25 20:00:08.983 +0000 UTC): 
ValidationException: 1 validation error detected: Value '2022-04-25 20:00:08.983 +0000 UTC' at 'certificateArn' failed to satisfy constraint: 
Member must satisfy regular expression pattern: arn:[\w+=/,.@-]+:acm:[\w+=/,.@-]*:[0-9]+:[\w+=,.@-]+(/[\w+=,.@-]+)*

(it errors out reading the aws_acm_certificate_validation’s certificate_arn)

Β 

Steps to Reproduce

terraform plan with an existing, unchanged aws_acm_certificate_validation in state, after upgrading to v4.12.0

This did NOT occur on any previous releases (I hadn’t version locked my providers yet for this new setup, and it just started.)

Locking my version to v4.11.0 resolved the issue, plan worked as expected.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 96
  • Comments: 27 (9 by maintainers)

Most upvoted comments

We are planning on releasing a v4.12.1 patch with this (and maybe one other) bug fix later today.

Can confirm that I am also facing the same issue on v4.12.0

β•·
β”‚ Error: reading ACM Certificate (2022-03-15 01:00:45.675 +0000 UTC): ValidationException: 1 validation error detected: Value '2022-03-15 01:00:45.675 +0000 UTC' at 'certificateArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:[\w+=/,.@-]+:acm:[\w+=/,.@-]*:[0-9]+:[\w+=,.@-]+(/[\w+=,.@-]+)*
β”‚ 
β”‚   with module.spoke_network.module.acm.aws_acm_certificate_validation.default[0],
β”‚   on ../modules/acm/main.tf line 30, in resource "aws_acm_certificate_validation" "default":
β”‚   30: resource "aws_acm_certificate_validation" "default" {
β”‚ 
β•΅
Releasing state lock. This may take a few moments..

I wasn’t locking the provider version earlier, but now have locked to v4.11.0 and that has fixed the issue.

Fix confirmed! Just tried the same resources on 4.12.1, everything worked βœ…

Thanks for the quick fix y’all!

The same here πŸ˜‰

Deleted

For the time being, just add the following to your terraform provider block.

terraform {
  required_version = ">= 1.1.9"

  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "= 4.11.0"
    }
  }
}

That will pin the aws provider to the previous version.

I can see that the pull request has been approved for fixing this but changes are yet to reflect compiled provider with tag v4.12.0

4.12.0 introduced the issue I would never expect for the fix to be released to the same tag

Same issue… waiting for a faster-than-light fix πŸ˜‰