infrastructure/ingress.tjo.cloud/records.tf
Tine cc12c5d30d
Some checks failed
/ lint (push) Failing after 2m28s
feat: wip
2024-08-04 19:50:50 +02:00

35 lines
797 B
HCL

locals {
listeners = [
{
domain = "k8s.tjo.cloud"
name = "api"
locations = ["SI", "DE"]
},
{
domain = "k8s.tjo.cloud"
name = "dashboard"
locations = ["SI", "DE"]
}
]
}
resource "digitalocean_record" "listeners" {
for_each = merge(flatten([
for listener in local.listeners :
[
for location in listener.locations : {
for ip in local.locations[location] : "${ip} for ${listener.name}.${listener.domain} at ${location}" => {
ip = ip
domain = listener.domain
name = listener.name
}
}
]
])...)
domain = each.value.domain
type = strcontains(each.value.ip, ":") ? "AAAA" : "A"
name = each.value.name
value = each.value.ip
ttl = 60
}