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

Extend nic section, add missing arguments like METHOD, GATEWAY or DNS.. #548

Closed
sk4zuzu opened this issue May 16, 2024 · 0 comments · Fixed by #555
Closed

Extend nic section, add missing arguments like METHOD, GATEWAY or DNS.. #548

sk4zuzu opened this issue May 16, 2024 · 0 comments · Fixed by #555

Comments

@sk4zuzu
Copy link
Collaborator

sk4zuzu commented May 16, 2024

Description

This section in documentation seems to be misleading/incomplete. It's actually possible to override the METHOD, GATEWAY, DNS arguments, like so:

NIC = [ DNS = "1.1.1.1", GATEWAY = "10.11.12.13, NETWORK_ID = "0" ]

There is a workaround, the template_section can be used like this:

resource "opennebula_virtual_machine" "vm2" {
  name = "vm2"
  template_id = opennebula_template.vm.id

  template_section {
    name = "NIC"
    elements = {
      NETWORK_ID = data.opennebula_virtual_network.vnets[local.instances.vm.vm2.network].id
      GATEWAY = local.instances.vm.vm2.gateway
    }
  }
}

But it would be great to have those things supported natively (so people could learn about them). We'll review and try to update the OpenNebula documentation as well. 🙂

New or affected resources and data sources

  • opennebula_template
  • opennebula_virtual_machine

Potential terraform configuration

resource "opennebula_virtual_machine" "vm2" {
  name = "vm2"
  template_id = opennebula_template.vm.id

  nic {
    network_id = "0"
    method     = "dhcp"
    gateway    = "10.11.12.13"
    dns        = "1.1.1.1"
  }
}

References

https://docs.opennebula.io/6.8/management_and_operations/references/template.html

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

Successfully merging a pull request may close this issue.

2 participants