Fix Dynu inventory by removing unsupported regexreplace usage

This commit is contained in:
beatz174-bit
2026-05-13 06:40:25 +10:00
parent 685a472572
commit 24cbb02bff
3 changed files with 34 additions and 16 deletions
@@ -1,16 +1,3 @@
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(replace(lower(format("%s_%s", record.hostname, record.record_type)), "*", "wildcard"), "[^a-z0-9]+", "_")))
? trim(regexreplace(replace(lower(format("%s_%s", record.hostname, record.record_type)), "*", "wildcard"), "[^a-z0-9]+", "_"), "_")
: format("record_%s", trim(regexreplace(replace(lower(format("%s_%s", record.hostname, record.record_type)), "*", "wildcard"), "[^a-z0-9]+", "_"), "_")),
record.id
) => record
}
}