diff --git a/modules/kube_machine/dns.tf b/modules/kube_machine/dns.tf index 6a06d24..35a9ca0 100644 --- a/modules/kube_machine/dns.tf +++ b/modules/kube_machine/dns.tf @@ -4,6 +4,10 @@ provider "dns" { } } +locals { + reverse_zone_ip = join(".", reverse(split(".", local.ip_network))) +} + resource "dns_a_record_set" "kube_machine" { for_each = { for n in var.nodes : n.name => n } @@ -13,4 +17,13 @@ resource "dns_a_record_set" "kube_machine" { "${local.ip_network}.${each.value.ip_octet}", ] ttl = 300 +} + +resource "dns_ptr_record" "kube_machine" { + for_each = { for n in var.nodes : n.name => n } + + zone = "${local.reverse_zone_ip}.in-addr.arpa." + name = each.value.ip_octet + ptr = "${each.value.name}.${local.dns_zone}." + ttl = 300 } \ No newline at end of file