From 004371f4c17ce37415779767b08788d749535fda Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 22 Mar 2024 12:03:37 +0100 Subject: [PATCH] feat: add var server_netif_filter to overwrite interface filter --- main.tf | 4 ++-- variables.tf | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 0b98379..548492a 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,7 @@ locals { ipv4_addresses = { for server_key, server in var.server : server.name => flatten([ for k, v in coalescelist(proxmox_virtual_environment_vm.server[server.name].ipv4_addresses, []) : - v if length(regexall("^(lo|docker|veth).*", 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 ]) } } @@ -11,7 +11,7 @@ locals { ipv6_addresses = { for server_key, server in var.server : server.name => flatten([ for k, v in coalescelist(proxmox_virtual_environment_vm.server[server.name].ipv6_addresses, []) : - v if length(regexall("^(lo|docker|veth).*", 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 ]) } } diff --git a/variables.tf b/variables.tf index d7e4d40..be99d5a 100644 --- a/variables.tf +++ b/variables.tf @@ -43,3 +43,8 @@ variable "server_guest_agent" { type = bool default = false } + +variable "server_netif_filter" { + type = string + default = "^(lo|docker|veth).*" +} -- 2.45.2