I've just spent WAAAAY more time than I'd like to admit debugging a template build issue which was caused by the fact that while Packer behaves as if RHEL-8.10-x86_64-dvd.iso and rhel-8.10-x86_64-dvd.iso are the same exact thing:
==> vsphere-iso: Mounting ISO images...
2024/07/15 14:54:32 packer-plugin-vsphere_v1.3.0_x5.0_linux_amd64 plugin: 2024/07/15 14:54:32 Check if ISO path is a Content Library path
2024/07/15 14:54:32 packer-plugin-vsphere_v1.3.0_x5.0_linux_amd64 plugin: 2024/07/15 14:54:32 ISO path not identified as a Content Library path
2024/07/15 14:54:32 packer-plugin-vsphere_v1.3.0_x5.0_linux_amd64 plugin: 2024/07/15 14:54:32 Using [REDACTEDLUN] ISOandMediaFolder/RHEL-8.10-x86_64-dvd.iso as the datastore path
2024/07/15 14:54:32 packer-plugin-vsphere_v1.3.0_x5.0_linux_amd64 plugin: 2024/07/15 14:54:32 Creating CD-ROM on controller '&{{{} 200 0xc000a60c80 <nil> <nil> <nil> 0 <nil> 0 <nil>} 0 []}' with iso '[REDACTEDLUN] ISOandMediaFolder/RHEL-8.10-x86_64-dvd.iso'
the reality is that this will result in ESX hosts not seeing the ISO and the CD/DVD will be in Disconnected state and you will possibly spend way too much time chasing why your DHCP is suddenly broken (which will not be the DHCP the installer is trying to use, but rather the freshly created VM trying to boot off PXE since the CD/DVD device is disconnected).
I think a more logical approach would be verify that the file name provided exists and fail early in the Prepare() if it's not a match to an existing file name in the datastore.
I've just spent WAAAAY more time than I'd like to admit debugging a template build issue which was caused by the fact that while Packer behaves as if RHEL-8.10-x86_64-dvd.iso and rhel-8.10-x86_64-dvd.iso are the same exact thing:
the reality is that this will result in ESX hosts not seeing the ISO and the CD/DVD will be in Disconnected state and you will possibly spend way too much time chasing why your DHCP is suddenly broken (which will not be the DHCP the installer is trying to use, but rather the freshly created VM trying to boot off PXE since the CD/DVD device is disconnected).