Разобрался:
locals {
cidr = "10.12.127.0/20"
bits = 32 - split("/", local.cidr)[1]
x = cidrhost(local.cidr, 0)
y = cidrhost(local.cidr, pow(2, local.bits) - 1)
}
output "x" {
value = local.x
}
output "y" {
value = local.y
}
Запуск:
Outputs:
x = 10.12.112.0
y = 10.12.127.255