Add healthchecksio provider and refactor ip-for-host collection

This commit is contained in:
Tobias Reisinger 2024-10-06 17:08:25 +02:00
parent ed51a86935
commit 6fdfd338a1
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
14 changed files with 147 additions and 49 deletions
modules/infrastructure

View file

@ -1,17 +1,38 @@
output "hosts" {
value = {
for subdomain in distinct([for record in ovh_domain_zone_record.server_records : record.subdomain]) :
subdomain => {
"hostname" = subdomain
"fqdn" = "${subdomain}.${ovh_domain_zone_record.server_records["${subdomain}:ipv4"].zone}"
for key, host in var.hosts :
key => {
"hostname" = host.hostname
"fqdn" = "${host.hostname}.serguzim.net"
"fqdn_vpn" = "${host.hostname}.vpn.serguzim.net"
"ipv4_address" = try(
ovh_domain_zone_record.server_records["${subdomain}:ipv4"].target,
local.server_addresses_separated["${key}:ipv4"].address,
null
)
"ipv6_address" = try(
ovh_domain_zone_record.server_records["${subdomain}:ipv6"].target,
local.server_addresses_separated["${key}:ipv6"].address,
null
)
ipv4_address_vpn = try(
local.tailscale_host_addresses_separated["${key}:ipv4"].address,
null
)
ipv6_address_vpn = try(
local.tailscale_host_addresses_separated["${key}:ipv6"].address,
null
)
}
}
}
output "healthchecksio" {
value = {
backup = {
for key, check in healthchecksio_check.backup : key => {
"id" = check.id
"ping_url" = check.ping_url
}
}
}
}