-
Notifications
You must be signed in to change notification settings - Fork 0
/
hosts.tf
24 lines (21 loc) · 866 Bytes
/
hosts.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# SPDX-FileCopyrightText: 2023 Masaru OKI
#
# SPDX-License-Identifier: Apache-2.0
locals {
hosts = {
"HostA" = { "VM Network" = [ "10.0.0.1/8" ],
"HostAB" = [ "192.168.0.1/24" ] }
"HostB" = { "VM Network" = [ "10.0.0.2/8" ],
"HostAB" = [ "192.168.0.2/24" ],
"HostBC" = [ "172.21.0.2/24" ] }
"HostC" = { "VM Network" = [ "10.0.0.3/8" ],
"HostBC" = [ "172.21.0.1/24" ] }
}
private_network = [for nic in distinct(flatten([
for host in values(local.hosts) : keys(host)
])) : nic if nic != "VM Network"]
netcount = [for nic in local.private_network :
length(compact([
for name in flatten([for host in values(local.hosts) : keys(host)]) :
name == nic ? nic : "" ]))]
}