terracadoles/modules/cadolesDNS/main.tf
Philippe Caseiro 2185af67c5 feat(module): adding DNS module
This module create entries on a DNS Server with DNSUPDATE.

extracted from "Cadoles Production v2 project"
2023-01-19 14:14:52 +01:00

29 lines
546 B
HCL

// Dependencies management
resource "null_resource" "depends_on" {
triggers = {
depends_on = join("", var.depends)
}
}
resource "dns_a_record_set" "a_records" {
for_each = var.dns_a_records
zone = var.dns_domain
name = each.key
ttl = 300
addresses = each.value
depends_on = [ null_resource.depends_on ]
}
resource "dns_cname_record" "cname_records" {
for_each = var.dns_cname_records
zone = var.dns_domain
name = each.key
cname = each.value
ttl = 300
depends_on = [ null_resource.depends_on ]
}