terraform-provider-dnsimple icon indicating copy to clipboard operation
terraform-provider-dnsimple copied to clipboard

[Question] Using AWS ACM with DNS validation

Open DXTimer opened this issue 1 year ago • 4 comments

I am trying to create multiple AWS certificates, but when I tried to create zone records it ended up with

│ A matching record already exists for this zone, Another record already exists
│ for _12ee1d57338f45a0e6ef43cxxx.example.com, cannot add a CNAME, A
│ CNAME record exists for _12ee1d57338f45a0e6ef43xxx.example.com,
│ cannot add another record

Any way to perform the update in place?

resource "dnsimple_zone_record" "dnsrecord" {
   for_each = {
    for dvo in aws_acm_certificate.certificate.domain_validation_options : dvo.domain_name => {
      record_name   = dvo.resource_record_name
      record_value = dvo.resource_record_value
      type   = dvo.resource_record_type
      domain_name = dvo.domain_name
    }
  }
  zone_name = var.dnsimple_domain
  name   = each.value.record_name
  value  = each.value.record_value
  type   = each.value.type
  ttl    = 3600
}

resource "aws_acm_certificate" "certificate" {
  domain_name               = var.domain_name
  validation_method         = "DNS"
  subject_alternative_names = var.hosts
  tags = {
    Environment = var.environment
    Terraform   = "true"
  }
}

Originally posted by @adiii717 in https://github.com/dnsimple/terraform-provider-dnsimple/issues/25#issuecomment-1396538933

DXTimer avatar Jan 19 '23 07:01 DXTimer