diff --git a/terraform/main.tf b/terraform/main.tf index f5a1934..71a5051 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -60,13 +60,7 @@ module "vms" { vcpu = each.value.vcpu ram = each.value.memory - network_interfaces = { - for_each = each.value.network_interfaces - { - network_id = opennebula_virtual_network.vnet[each.value.network_name].id, - ip = opennebula_virtual_network.vnet[each.value.network_name].ip4 - } - } + network_interfaces = each.value.network_interfaces tag_labels = each.value.labels diff --git a/terraform/modules/virtualMachine/main.tf b/terraform/modules/virtualMachine/main.tf index 0e06c65..e0e4873 100644 --- a/terraform/modules/virtualMachine/main.tf +++ b/terraform/modules/virtualMachine/main.tf @@ -71,7 +71,7 @@ resource "opennebula_template" "vm_template" { for_each = var.network_interfaces content { - network_id = nic.value.network_id + network_id = opennebula_virtual_network.vnet[nic.value.network_name].id model = "virtio" ip = nic.value.ip }