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

vlan_id is ignored with opennebula_virtual_network and ovswitch #515

Open
kepi opened this issue Jan 13, 2024 · 0 comments · May be fixed by #561
Open

vlan_id is ignored with opennebula_virtual_network and ovswitch #515

kepi opened this issue Jan 13, 2024 · 0 comments · May be fixed by #561

Comments

@kepi
Copy link

kepi commented Jan 13, 2024

Description

When I set vlan_id, it is ignored. Terraform acts as everything is well, but there is no VLAN set in OpenNebula.

There is nothing relevant in oned log. I'm using CE version, same problem on 6.4 and 6.6 (I upgraded to 6.6. when it didn't work).

It was working on some of previous versions, but unfortunately I'm not sure which was it. I didn't need it in couple months and memory is fuzzy.

Terraform and Provider version

❯ terraform -v
Terraform v1.6.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/dns v3.4.0
+ provider registry.terraform.io/nbering/ansible v1.0.4
+ provider registry.terraform.io/opennebula/opennebula v1.3.1

Affected resources and data sources

  • opennebula_virtual_network

Terraform configuration

terraform {
  required_version = "1.6.6"
  required_providers {
    opennebula = {
      source  = "opennebula/opennebula",
      version = "1.3.1"
    }
  }
}

variable "one_endpoint" {}
variable "one_username" {}
variable "one_password" {}
variable "one_flow_endpoint" {}

provider "opennebula" {
  endpoint      = var.one_endpoint
  flow_endpoint = var.one_flow_endpoint
  username      = var.one_username
  password      = var.one_password
}

resource "opennebula_virtual_network" "reproduce" {
  name        = "reproduce-public"
  permissions = "660"
  group       = "oneadmin"
  type        = "ovswitch"
  bridge      = "ovs-pub"
  vlan_id     = 1458

  dns     = "10.128.2.1"
  gateway = "10.128.2.1"

  cluster_ids = [0]
}

Expected behavior

VLAN should be set in OpenNebula as instructed in configuration.

Actual behavior

VLAN is empty.

Steps to Reproduce

  1. create main.tf witch content fo terraform configuration (setup your variables ofc)
  2. terraform init
  3. terraform apply
  4. check created network in opennebula

Here is output of terraform apply:

❯ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # opennebula_virtual_network.reproduce will be created
  + resource "opennebula_virtual_network" "reproduce" {
      + automatic_vlan_id = (known after apply)
      + bridge            = "ovs-pub"
      + cluster_ids       = [
          + 0,
        ]
      + default_tags      = (known after apply)
      + dns               = "10.128.2.1"
      + gateway           = "10.128.2.1"
      + gid               = (known after apply)
      + gname             = (known after apply)
      + group             = "oneadmin"
      + guest_mtu         = 1500
      + id                = (known after apply)
      + mtu               = 1500
      + name              = "reproduce-public"
      + permissions       = "660"
      + physical_device   = (known after apply)
      + reservation_ar_id = -1
      + reservation_vnet  = -1
      + security_groups   = (known after apply)
      + tags_all          = (known after apply)
      + type              = "ovswitch"
      + uid               = (known after apply)
      + uname             = (known after apply)
      + vlan_id           = "1458"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

opennebula_virtual_network.reproduce: Creating...
opennebula_virtual_network.reproduce: Creation complete after 5s [id=77]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

and here is network in ONE:

❯ onevnet show reproduce-public
VIRTUAL NETWORK 77 INFORMATION
ID                       : 77
NAME                     : reproduce-public
USER                     : oneadmin
GROUP                    : oneadmin
LOCK                     : None
CLUSTERS                 : 0
BRIDGE                   : ovs-pub
STATE                    : READY
VN_MAD                   : ovswitch
AUTOMATIC VLAN ID        : NO
AUTOMATIC OUTER VLAN ID  : NO
USED LEASES              : 0

PERMISSIONS
OWNER                    : um-
GROUP                    : um-
OTHER                    : ---

VIRTUAL NETWORK TEMPLATE
BRIDGE="ovs-pub"
BRIDGE_TYPE="openvswitch"
DNS="10.128.2.1"
GATEWAY="10.128.2.1"
GUEST_MTU="1500"
MTU="1500"
OUTER_VLAN_ID=""
PHYDEV=""
SECURITY_GROUPS="0"
VLAN_ID=""
VN_MAD="ovswitch"

ADDRESS RANGE POOL

LEASES
AR  OWNER        MAC    IP PORT_FORWARD   IP6

VIRTUAL ROUTERS

VIRTUAL MACHINES
UPDATED                  :
OUTDATED                 :
ERROR                    :

Debug output

https://gist.github.com/kepi/c8d8a8af6fe09cb05ec5bf9cafe01e0a

Panic output

No response

Important factoids

I'm using oneadmin account for network definition, so ACL shouldn't be issue.

References

No response

@frousselet frousselet added this to the 1.4.1 milestone Jan 16, 2024
@frousselet frousselet modified the milestones: 1.4.1, 1.4.2 May 30, 2024
treywelsh added a commit that referenced this issue Jul 3, 2024
@treywelsh treywelsh linked a pull request Jul 3, 2024 that will close this issue
7 tasks
@treywelsh treywelsh self-assigned this Jul 3, 2024
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.

3 participants