packer-plugin-hyperv icon indicating copy to clipboard operation
packer-plugin-hyperv copied to clipboard

Allow multiple nics to be connected to VM

Open remi-espie opened this issue 2 years ago • 3 comments

This allows Packer to create and allocate multiple nics to a VM through switches_names array. switch_name is still available to ensure backward compatibility. It also adds mac_addresses array, which will give the first element as a mac address to the first switch of switches_names, the 2nd element to the 2nd switch, etc.

This is quite bare bone, only creating, adding and deleting (if needed) multiple nics the the VM. This answer some of #86 needs but not all of them so I'm not marking it as closed.

Personally tested and working in the following cases:

  • [x] only switch_name is set (no switches_names are set)
  • [x] only switches_names are set (no switch_name is set)
  • [x] one or multiple switches_names are set
  • [x] already existing switches are not deleted
  • [x] no mac addresses are set
  • [x] less mac addresses are set than switches
  • [x] more mac addresses are set than switches

remi-espie avatar Oct 18 '23 10:10 remi-espie

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Oct 18 '23 10:10 hashicorp-cla

sorry about both last commits, some git mistakes by my side. They were removed by a push force, don't take them into account.

remi-espie avatar Jan 24 '24 10:01 remi-espie

Hi All, I need this too. I'm working on an update that implements what the commenters suggested as the better way.

It is much larger change. I'll submit it as a separate PR against main.

Thanks, Greg

galthaus avatar Mar 15 '24 16:03 galthaus