When I was doing a configuration for Packer to build VM templates on VMWare I spent quite a while troubleshooting the solution. Please see my collection of errors. Hope that helps you to find your way out.
I was using “vsphere-iso” driver.
If you are looking for a good explanation with all the details, please take a look at Dmitry’s Teslya blog
error creating vm:
A specified parameter was not correct: spec.deviceChange.device.port.switchUuid
Check that the VM you are trying to create is in VLAN that is available at the chosen VSphere cluster
————————
error mounting an image '[DATASTORE] ISO/Microsoft/W2019/Windows2019.iso':
[DATASTORE] ISO/Microsoft/W2019/Windows2019.iso is not a valid iso path
In this case it was a bug in the current version of Packer. You can try to run with a previous version of Packer.
————————
Build 'vsphere-iso' errored: Error trying to stat : autounattend.xml :
CreateFile autounattend.xml: The system cannot find the file specified.
You need to confirm from where you run your build. That file should be accessible from that folder. As a test you can try to put a full path to your config.
————————
Build 'vsphere-iso' errored:
Timeout waiting for WinRM.
Looks like DHCP is not working so VM cannot get an IP-address.
————————
Hope that helps you with the troubleshooting.
There are more articles about how to work with HachiCorp tools like Terraform here.