fix: add a correct way to detect bridge/route
This commit is contained in:
parent
e47d508262
commit
ad2c717ffb
@ -111,7 +111,7 @@ resource "libvirt_network" "additional_networks" {
|
||||
count = length(var.subnets)
|
||||
name = var.network_names[count.index]
|
||||
bridge = "br_${var.network_names[count.index]}"
|
||||
mode = "route"
|
||||
mode = var.dhcp[count.index] == true ? "bridge" : "route"
|
||||
addresses = ["${var.subnets[count.index]}"]
|
||||
dhcp {
|
||||
enabled = var.dhcp[count.index]
|
||||
@ -132,7 +132,7 @@ resource "libvirt_domain" "net-lab" {
|
||||
network_name = var.networkname
|
||||
mac = each.value.mac
|
||||
# do not wait for a lease if networkname == "host-bridge"
|
||||
wait_for_lease = var.networkname == "host-bridge" ? false : true
|
||||
wait_for_lease = substr(var.networkname, 0, 2) == "br" ? true : false
|
||||
}
|
||||
dynamic "network_interface" {
|
||||
for_each = each.value.network
|
||||
@ -140,7 +140,7 @@ resource "libvirt_domain" "net-lab" {
|
||||
network_name = network_interface.value["name"]
|
||||
mac = network_interface.value["mac"]
|
||||
addresses = network_interface.value["address"]
|
||||
wait_for_lease = network_interface.value.mode == "bridge" ? false : true
|
||||
wait_for_lease = substr(network_interface.value.mode, 0, 2) == "br" ? true : false
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user