Skip to content

[opennebula_virtual_network] Can't add more than 1 address range to a reserveration #625

@flappje

Description

@flappje

Description

I want to create an address reservation for a virtual network and i want to add multiple address ranges

This is possible in the gui / cli so i'm my thought this should also work in the terraform code.

Terraform and Provider version

OpenTofu v1.10.6
on linux_amd64

  • provider registry.opentofu.org/opennebula/opennebula v1.5.0

Affected resources and data sources

opennebula_virtual_network

Terraform configuration

locals {
  extra_ips = ["192.168.1.10", "192.168.1.20"]
}

resource "opennebula_virtual_network" "default" {
  name  = "test_network"
  group = "test"

  automatic_vlan_id = true

  mtu             = 1500
  guest_mtu       = 1500
}

resource "opennebula_virtual_network_address_range" "default" {
  virtual_network_id = opennebula_virtual_network.default.id
  ar_type            = "IP4"
  ip4                = "192.168.56.1.1"
  size               = 250
}


resource "opennebula_virtual_network" "extra_ips" {
  for_each = { for ip in local.extra_ips: ip => ip }

  # virtual_network
  name  = "test_reserverations"
  group = "test"

  reservation_vnet     = opennebula_virtual_network.default.id
  reservation_ar_id    = 0
  reservation_first_ip = each.key
  reservation_size     = 1
}

Expected behavior

create a virtual network for the reservations and add both ip (ranges) to the reservation

Actual behavior

opennebula_virtual_network.extra_ips["192.168.0.20"]: Creating...
╷
│ Error: Failed to reserve network addresses
│
│   with opennebula_virtual_network.extra_ips["192.168.0.20"],
│   on main.tf line 55, in resource "opennebula_virtual_network" "extra_ips:
│   55: resource "opennebula_virtual_network" "extra_ips" {
│
│ Virtual network (ID: 9) reservation: OpenNebula error [INTERNAL]: [one.vn.reserve] NAME is already taken by NET    
│ 2318.
╵

Steps to Reproduce

run terraform apply

Debug output

No response

Panic output

No response

Important factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions