OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
63 stars 52 forks source link

```opennebula_virtual_machine``` secondary IP #494

Open TGM opened 12 months ago

TGM commented 12 months ago

Description

Hello,

Can you please add support for addind secondary IPs in the opennebula_virtual_machie-nic resource?

https://github.com/OpenNebula/terraform-provider-opennebula/blob/0cbd9d17f1ba6ffaef1304781f0583e2a7b424b1/opennebula/resource_opennebula_virtual_machine.go#L52

New or affected resources and data sources

opennebula_virtual_machine

Potential terraform configuration

opennebula_virtual_machine "vm" {
   nic_alias = { 
        # Mandatory
        IP         = x.x.x.x
        NETWORK_ID = xxx
        PARENT     = NICx
      }
  }
}
TGM commented 11 months ago

Hey guys,

Any update on this? We tried an alternative approach using the template_section, but it does not keep track of the previous changed. Anyway it's a different bug that will become irrelevant once you implement NIC_ALIAS.

TGM commented 11 months ago

A potential resource allocation manner that could be suppassed by NIC_ALIAS.

  # dynamic "template_section" {
  #   for_each = {
  #     for k, v in opennebula_virtual_network_address_range.ar :
  #       k => v if try(v.custom.SECONDARY, false)
  #   }

  #   content {
  #     name = "NIC_ALIAS"

  #     elements = {
  #       # Mandatory
  #       IP         = template_section.value.ip4
  #       NETWORK_ID = template_section.value.virtual_network_id
  #       PARENT     = replace(template_section.value.custom.PARENT, "eth", "NIC")
  #     }
  #   }
  # }
github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days.

TGM commented 3 months ago

BUMP

TGM commented 3 months ago

This is allso a good alternative, if a parent is set than set the interface as alias, else do nothing.

dynamic "nic" {
    for_each = {
      for k, v in opennebula_virtual_network_address_range.ar :
        k => v if try(v.custom.PARENT, false)
    }

    content {
      model         = "virtio"
      virtio_queues = local.virtio_queues
      network_id    = nic.value.virtual_network_id
      ip            = nic.value.ip4

      parent        = optional parent interface
    }
  }