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

NICs being configured twice on Rocky Linux 9 #2271

Open
4 tasks done
bab5470 opened this issue Oct 1, 2024 · 1 comment
Open
4 tasks done

NICs being configured twice on Rocky Linux 9 #2271

bab5470 opened this issue Oct 1, 2024 · 1 comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage

Comments

@bab5470
Copy link

bab5470 commented Oct 1, 2024

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

1.6.3

Terraform Provider

2.9.2

VMware vSphere

8.0.3

Description

I have a terraform script that performs a clone operation on a VMware template created with packer. In the terraform script I add two NICs to the existing VM (for a total of 3) and then configure IP information on all three.

What I see is that the new NICs in Rocky Linux are configured but duplicated:

ens256
VMware customization ens256
ens224
VMware customization ens224
ens192
VMware customization ens192

I am running openvmtools on the system. It seems like network connections are getting created in two places:

The ens connections are created in /etc/sysconfig/network-scripts, and the "Vmware Customizations" connections are created in /etc/Network-Manager/system-connections

I don't think connections are supposed to be created in both locations and obviously, we don't want our NIC/connections named "VMware customization xxxx"

Is this a bug in the VMware terraform provider, openvmtools, Rocky Linux?

Affected Resources or Data Sources

resource/vsphere_virtual_machine

Terraform Configuration

Variable file:

variable "vsphere_user" {
  type    = string
  default = "[email protected]"
}

variable "vsphere_password" {
  type        = string
  description = "Terraform AD password"
}

variable "vm_template_name" {
  type        = string
  description = "The template to clone to create the VM"
  default     = "ROCKY9"
}

variable "root_password" {
  type        = string
  description = "Local linux root password"
}

variable vsphere_server {
  type        = string
  description = "VMware Server DNS Name"
}

variable vsphere_datacenter {
  type        = string
  description = "VMware Datacenter"
}

variable "vsphere_networks" {
  type = map(string)
  description = "A map of VM Networks for different NICs (e.g., nic1, nic2, nic3)"
}

variable vmware-hostnames {
  type        = map(string)
  description = "List of VM Names"
}

variable datastores {
  type        = map(string)
  description = "List of datastores"
}

variable vm_ips {
  type        = map(map(string))
  description = "List of VM IPs"
}

variable vm-count {
  description = "Number of VMs to create"
  type        = number
}

variable vsphere_resource_pool {
  description = "VMware Resource Pool"
  type        = string
}

variable ipv4_netmasks {
  description = "IPv4 Netmask"
  type        = map(number)
}

variable dns_server_list {
  description = "DNS Server List"
  type        = list(string)
}

variable ipv4_gateway {
  description = "IPv4 Gateway"
  type        = string
}

variable firmware {
  description = "EFI or BIOS"
  type        = string
}

variable dns_domain {
  description = "DNS Domain"
  type        = string
}

Terraform script

provider "vsphere" {
  user           = var.vsphere_user
  password       = var.vsphere_password
  vsphere_server = var.vsphere_server

  # Allow self signed certs
  allow_unverified_ssl = true
}

data "vsphere_datacenter" "dc" {
  name = var.vsphere_datacenter
}

data "vsphere_datastore" "datastore" {
  name          = var.datastores[0]
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "nic1" {
  name          = var.vsphere_networks["nic1"]
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "nic2" {
  name          = var.vsphere_networks["nic2"]
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "nic3" {
  name          = var.vsphere_networks["nic3"]
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_virtual_machine" "template" {
  name          = var.vm_template_name
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_resource_pool" "pool" {
  name          = var.vsphere_resource_pool
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_virtual_machine" "vm" {
  count            = var.vm-count
  name             = var.vmware-hostnames[count.index]
  resource_pool_id = data.vsphere_resource_pool.pool.id
  datastore_id     = data.vsphere_datastore.datastore.id

  wait_for_guest_net_timeout = 20

  num_cpus = 4
  memory   = 4096
  guest_id = "rockylinux_64Guest"

  scsi_type = "pvscsi"
  firmware  = var.firmware

  network_interface {
    network_id   = data.vsphere_network.nic1.id
    adapter_type = "vmxnet3"
  }

  network_interface {
    network_id   = data.vsphere_network.nic2.id
    adapter_type = "vmxnet3"
  }

  network_interface {
    network_id   = data.vsphere_network.nic3.id
    adapter_type = "vmxnet3"
  }

  disk {
    label            = "disk0"
    size             = 40
    eagerly_scrub    = false
    thin_provisioned = true
  }

  cdrom {
    client_device = true

  }

  clone {
    template_uuid = data.vsphere_virtual_machine.template.id
    timeout       = "180"
    customize {
      timeout = "180"
      linux_options {
        host_name = var.vmware-hostnames[count.index]
        domain    = var.dns_domain
      }

      network_interface {
        ipv4_address = var.vm_ips[count.index]["nic1"]
        ipv4_netmask = var.ipv4_netmasks["nic1"]
        dns_server_list = var.dns_server_list
      }

      network_interface {
        ipv4_address = var.vm_ips[count.index]["nic2"]
        ipv4_netmask = var.ipv4_netmasks["nic2"]
      }

      network_interface {
        ipv4_address = var.vm_ips[count.index]["nic3"]
        ipv4_netmask = var.ipv4_netmasks["nic3"]
      }

      ipv4_gateway    = var.ipv4_gateway
    }
  }
}

Debug Output

I am happy to provide this privately but not post debug output with sensitive information about our environment in a public place. Please let me know how I send this safely/securely.

Panic Output

No response

Expected Behavior

A single set of interfaces are connected and configured.

Actual Behavior

Multiple nics show up in nmtui or nmcli with different names but identical configs.

Steps to Reproduce

Run the above scripts

Environment Details

Rocky Linux 9.4
Open-VM-Tools 12.3.5

Screenshots

image
image
image
image

References

No response

@bab5470 bab5470 added bug Type: Bug needs-triage Status: Issue Needs Triage labels Oct 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

Hello, bab5470! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage
Projects
None yet
Development

No branches or pull requests

1 participant