2

I didn't see any examples of this on the internet so I thought I'd post the solution here.

nowthatsamatt
  • 881
  • 1
  • 8
  • 11

1 Answers1

2

WARNING: The UltraDNS API will try to "help" you by placing the ending "." on the name. This will cause Terraform to think there are changes every time you plan or apply.

PowerDNS:

locals {
  sorted_pdns_hostnames = "${sort(module.server.hostnames)}"
  records               = "${formatlist("10 10 80 %s.${var.vpc}.${var.region}.private.", local.sorted_pdns_hostnames)}"
}

resource "powerdns_record" "pool" {
  zone    = "${var.pdns_zone}"
  name    = "${var.pdns_name}"
  type    = "SRV"
  ttl     = 300
  records = ["${local.records}"]
}

UltraDNS:

locals {
  sorted_hostnames = "${sort(module.server.hostnames)}"
  rdata            = "${formatlist("10 10 80 %s.${var.vpc}.${var.region}.private.", local.sorted_hostnames)}"
}

resource "ultradns_record" "pool" {
  zone  = "${var.zone_domain}"
  name  = "${var.ultradns_record_name}"
  rdata = ["${local.rdata}"]
  type  = "SRV"
  ttl   = 300
}
nowthatsamatt
  • 881
  • 1
  • 8
  • 11