InvalidChangeBatch: [RRSet of type CNAME with DNS name x. is not permitted as it conflicts with other records with the same DNS name in zone x.]

Viewed 3942

I'm trying to write a terraform module that creates Route53 entries based for a geolocalised app. My code seems to work fine for the first time but then it breaks with the error in the title.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.3.0"
    }
  }
}
resource "aws_route53_record" "cdn_cname" {
  zone_id         = "${var.route53_zone_id}"
  name            = "${var.domain}"
  type            = "CNAME"
  ttl             = 300
  allow_overwrite = true
  set_identifier  = "${var.envName}Id"
  records         = ["${var.records}"]


  geolocation_routing_policy {
    continent     = "${var.continent}"
    country       = "${var.country}"
  }
}

The error seems explicit enough but whey I try to manually create a CNAME with the same record as another one it seems to work fine. What's the difference between them?

0 Answers
Related