Add Dynu brownfield DNS inventory outputs and generator

This commit is contained in:
beatz174-bit
2026-05-13 06:03:32 +10:00
parent 034ad17cf9
commit 52bd2d9fa2
5 changed files with 276 additions and 38 deletions
@@ -0,0 +1,16 @@
data "dynu_dns_records" "root" {
hostname = var.dynu_root_domain
}
locals {
dynu_dns_record_name_map = {
for record in data.dynu_dns_records.root.records :
format(
"%s_%s",
can(regex("^[a-z]", regexreplace(lower(format("%s_%s", record.hostname, record.record_type)), "[^a-z0-9]+", "_")))
? trim(regexreplace(lower(format("%s_%s", record.hostname, record.record_type)), "[^a-z0-9]+", "_"), "_")
: format("record_%s", trim(regexreplace(lower(format("%s_%s", record.hostname, record.record_type)), "[^a-z0-9]+", "_"), "_")),
record.id
) => record
}
}