Skip to content

Commit

Permalink
Add PTR records
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsntTheWay committed Jan 19, 2024
1 parent c753ac9 commit fa2ca83
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/kube_machine/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -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
}

0 comments on commit fa2ca83

Please sign in to comment.