fix: use try to set default for server list (#7)
Reviewed-on: #7 Co-authored-by: Robert Kaussow <mail@thegeeklab.de> Co-committed-by: Robert Kaussow <mail@thegeeklab.de>
This commit is contained in:
parent
a202dc8ef3
commit
ef0b91ae3d
4
main.tf
4
main.tf
@ -1,7 +1,7 @@
|
|||||||
locals {
|
locals {
|
||||||
ipv4_addresses = {
|
ipv4_addresses = {
|
||||||
for server_key, server in var.server : server.name => flatten([
|
for server_key, server in var.server : server.name => flatten([
|
||||||
for k, v in coalescelist(proxmox_virtual_environment_vm.server[server.name].ipv4_addresses, []) :
|
for k, v in try(proxmox_virtual_environment_vm.server[server.name].ipv4_addresses, []) :
|
||||||
v if length(regexall(try(server.netif_filter, var.server_netif_filter), proxmox_virtual_environment_vm.server[server.name].network_interface_names[k])) > 0
|
v if length(regexall(try(server.netif_filter, var.server_netif_filter), proxmox_virtual_environment_vm.server[server.name].network_interface_names[k])) > 0
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@ locals {
|
|||||||
locals {
|
locals {
|
||||||
ipv6_addresses = {
|
ipv6_addresses = {
|
||||||
for server_key, server in var.server : server.name => flatten([
|
for server_key, server in var.server : server.name => flatten([
|
||||||
for k, v in coalescelist(proxmox_virtual_environment_vm.server[server.name].ipv6_addresses, []) :
|
for k, v in try(proxmox_virtual_environment_vm.server[server.name].ipv6_addresses, []) :
|
||||||
v if length(regexall(try(server.netif_filter, var.server_netif_filter), proxmox_virtual_environment_vm.server[server.name].network_interface_names[k])) > 0
|
v if length(regexall(try(server.netif_filter, var.server_netif_filter), proxmox_virtual_environment_vm.server[server.name].network_interface_names[k])) > 0
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user