Allow multiple nics to be connected to VM
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_nameis set (noswitches_namesare set) - [x] only
switches_namesare set (noswitch_nameis set) - [x] one or multiple
switches_namesare 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
sorry about both last commits, some git mistakes by my side. They were removed by a push force, don't take them into account.
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