josenk / terraform-provider-esxi

Terraform-provider-esxi plugin
GNU General Public License v3.0
538 stars 154 forks source link

MAC conflict #184

Closed tosqui17 closed 1 year ago

tosqui17 commented 1 year ago

Describe the bug After creating a ubuntu 22.04.1 image via packer, esxi automatically assigns a mac address to my network card (e.g. 00:0c:29:e7:c9:ec). Later, if I try to apply it in the network_interfaces settings in main.tf, machine does not turn on.

Error: Failed to power on. │ │ with esxi_guest.Ubuntu22041, │ on main.tf line 9, in resource "esxi_guest" "Ubuntu22041": │ 9: resource "esxi_guest" "Ubuntu22041" {

If I do it manually via esxi dashboard, it says: Impermissible static Ethernet address: '00:0c:29:e7:c9:ec'. It conflicts with VMware reserved MACs.

To Reproduce Steps to reproduce the behavior:

  1. terraform apply

Terraform files

main.tf

provider "esxi" { esxi_hostname = var.esxi_hostname esxi_hostport = var.esxi_hostport esxi_username = var.esxi_username esxi_password = var.esxi_password }

resource "esxi_guest" "Ubuntu22041" { guest_name = "Ubuntu22041" boot_disk_type = "thin" disk_store = "datastore1" memsize = "4096" numvcpus = "2" boot_disk_size = "20" power = "on" network_interfaces { virtual_network = "VM Network" nic_type = "vmxnet3" mac_address = "00:0c:29:e7:c9:ec" }

    }

terraform apply

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

Terraform will perform the following actions:

esxi_guest.Ubuntu22041 will be created

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

josenk commented 1 year ago

You need to follow the rules of mac address assignment. This problem is not related to the provider or terraform. This restriction is from vmware.