Refactor network module to accept free-form config maps

Replace hypervisor_parent/witness_parent strings with hypervisor_config
and witness_config map(string) variables, matching the pattern already
used by the storage module. incus_networks in the root module is updated
from map(number) to map(object) carrying type and the two config maps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 14:05:40 +01:00
parent 6b53db3ad9
commit 36eaa727ab
5 changed files with 30 additions and 19 deletions

View File

@@ -11,9 +11,7 @@ resource "incus_network" "hypervisor" {
name = var.name
target = each.key
type = var.type
config = {
"parent" = var.hypervisor_parent
}
config = var.hypervisor_config
}
resource "incus_network" "witness" {
@@ -21,9 +19,7 @@ resource "incus_network" "witness" {
name = var.name
target = each.key
type = var.type
config = {
"parent" = var.witness_parent
}
config = var.witness_config
}
resource "incus_network" "this" {

View File

@@ -15,12 +15,12 @@ variable "witnesses" {
type = set(string)
}
variable "hypervisor_parent" {
type = string
default = "br0"
variable "hypervisor_config" {
type = map(string)
default = {}
}
variable "witness_parent" {
type = string
default = "dummy0"
variable "witness_config" {
type = map(string)
default = {}
}