Skip to content

Instantly share code, notes, and snippets.

@jschr
Last active April 13, 2017 01:13
Show Gist options
  • Save jschr/c7597ee6478e0a465f0c36eaa9f10d11 to your computer and use it in GitHub Desktop.
Save jschr/c7597ee6478e0a465f0c36eaa9f10d11 to your computer and use it in GitHub Desktop.
terraform dns entries broken
# ideally we could create the dns entries by iterating over
# each record but terraform currently doesn't computed variables
# when using count.
resource "aws_route53_record" "mailgun_sending" {
# create an route 53 entry for each record for the mailgun domain
count = "${length(mailgun_domain.domain.sending_records)}"
zone_id = "${data.aws_route53_zone.domain.zone_id}"
ttl = "300"
# select the record name from the current count
name = "${element(mailgun_domain.domain.sending_records.*.name, count.index)}"
# select the record type from the current count
type = "${element(mailgun_domain.domain.sending_records.*.record_type, count.index)}"
# select the record value from the current count
records = ["${element(mailgun_domain.domain.sending_records.*.value, count.index)}"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment