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

sendgrid_domain_authentication always creating new CNAME config and resetting previous one

Open zsozso opened this issue 2 years ago • 0 comments

I have problem which is probably related with sendgrid_domain_authentication resource. Whenever I execute Terraform it is always creating a new Cname records independently from the sendgrid resource was already created Is it a bug or you have an idea how I can avoid the regeneration?

Thank you

resource "sendgrid_domain_authentication" "default" {
  domain = "${var.dns_zone_name}"
  is_default = true
  automatic_security = true
}

resource "azurerm_dns_cname_record" "sendgrid" {
  depends_on = [
     sendgrid_domain_authentication.default
  ]
  count = 3 // SendGrid generates 3 different CNAME records

  name = trimsuffix(sendgrid_domain_authentication.default.dns[count.index].host, ".${var.dns_zone_name}")
  resource_group_name = "${data.azurerm_dns_zone.dns_zone.resource_group_name}"
  zone_name           = "${data.azurerm_dns_zone.dns_zone.name}"
  ttl                 = 3600
  record =  "${sendgrid_domain_authentication.default.dns[count.index].data}"
}

zsozso avatar Mar 10 '22 08:03 zsozso