Manage network dependencies for virtual machines
This commit is contained in:
parent
d5c900d721
commit
76b7c779bc
|
@ -22,7 +22,7 @@ provider "dns" {
|
||||||
/*
|
/*
|
||||||
* Virtual networks
|
* Virtual networks
|
||||||
*/
|
*/
|
||||||
resource "opennebula_virtual_network" "vnet"{
|
resource "opennebula_virtual_network" "vnets"{
|
||||||
for_each = var.virtual_networks
|
for_each = var.virtual_networks
|
||||||
name = each.key
|
name = each.key
|
||||||
vlan_id = each.value.vlan_id
|
vlan_id = each.value.vlan_id
|
||||||
|
@ -60,7 +60,7 @@ module "vms" {
|
||||||
vcpu = each.value.vcpu
|
vcpu = each.value.vcpu
|
||||||
ram = each.value.memory
|
ram = each.value.memory
|
||||||
|
|
||||||
vnets = opennebula_virtual_network.vnet
|
vnets = opennebula_virtual_network.vnets
|
||||||
network_interfaces = each.value.network_interfaces
|
network_interfaces = each.value.network_interfaces
|
||||||
|
|
||||||
tag_labels = each.value.labels
|
tag_labels = each.value.labels
|
||||||
|
@ -72,7 +72,8 @@ module "vms" {
|
||||||
data_image_source = ""
|
data_image_source = ""
|
||||||
|
|
||||||
depends = [
|
depends = [
|
||||||
opennebula_virtual_network.vnet[each.value.depends[0]].id
|
for dp in each.value.network_interfaces:
|
||||||
|
opennebula_virtual_network.vnets[dp.network_name].id
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ virtual_machines = {
|
||||||
source = "http://localhost/fabrica/infra/production/amon.fabrica.local/system/amon.fabrica.local.img"
|
source = "http://localhost/fabrica/infra/production/amon.fabrica.local/system/amon.fabrica.local.img"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
depends = [ "internet" ]
|
|
||||||
},
|
},
|
||||||
scribe = {
|
scribe = {
|
||||||
fqdn = "scribe.fabrica.local",
|
fqdn = "scribe.fabrica.local",
|
||||||
|
@ -40,6 +39,5 @@ virtual_machines = {
|
||||||
source = "http://localhost/fabrica/infra/production/scribe.fabrica.local/system/scribe.fabrica.local.img"
|
source = "http://localhost/fabrica/infra/production/scribe.fabrica.local/system/scribe.fabrica.local.img"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
depends = [ "internet" ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue