Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't attach more than one NIC from the same vnet #572

Open
alvarocurt opened this issue Oct 11, 2024 · 0 comments
Open

Can't attach more than one NIC from the same vnet #572

alvarocurt opened this issue Oct 11, 2024 · 0 comments

Comments

@alvarocurt
Copy link

alvarocurt commented Oct 11, 2024

Description

A project requires us to deploy VMs with multiple NICs in the same network, with different asigned IPs.
However, the terraform provider doesn't seem to allow us to do that.

Terraform and Provider version

Terraform v1.9.7
on linux_amd64

  • provider registry.terraform.io/opennebula/opennebula v1.4.0

Affected resources and data sources

opennebula_virtual_machine
opennebula_virtual_network

Terraform configuration

resource "opennebula_virtual_machine" "loadcore_agent-dn1" {
  name        = "reference-loadcore_agent-dn1"
  template_id = 162
  cpu         = 4
  vcpu        = 4
  memory      = 8192

  context = {
    NETWORK = "YES"
    SET_HOSTNAME = "$NAME"
    USERNAME = "jenkins"
  }

  nic {
    model           = "virtio"
    network_id      = opennebula_virtual_network.vnet-private_oneKE.id
  }
  nic {
    model           = "virtio"
    network_id      = opennebula_virtual_network.vnet-private_oneKE.id
  }

}

Expected behavior

Deploys a VM with 2 NICs in vnet vnet-private_oneKE

Actual behavior

│ Error: Duplicate object key
│
│   on tf-loadcore_agent-dn1.tf line 34, in output "loadcore_agent-dn1-ips":
│   34:   value = { for nic in opennebula_virtual_machine.loadcore_agent-dn1.nic[*] : nic.network_id => nic.computed_ip }
│     ├────────────────
│     │ nic.network_id is 603
│
│ Two different items produced the key "603" in this 'for' expression. If duplicates are expected, use the ellipsis (...) after the value expression to enable grouping by key.
╵

Steps to Reproduce

Create a vnet and try deploying a VM with 2 NICs from it.

Debug output

No response

Panic output

No response

Important factoids

No response

References

No response

EDIT: block for the error output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants