filenotfoundexceptionpackervmware-workstationhashicorp

Packer error with build from vmx file - "file was not found"


I have a problem that I can't figure out. I'm trying to make my first clone of a VM from Packer (Hashicorp) here is my HCL :

source "vmware-vmx" "basic-example" { 
 source_path = "D:/HashiCorp/Packer1.8.0/Project/WindowsServer2022.vmx"
 vm_name = "Test1"
 communicator = "winrm"
 winrm_host = "redteam"
 winrm_username = "admin"
 winrm_password = "Disc0very"
 shutdown_command = "shutdown /s"
}
build {
  sources = ["sources.vmware-vmx.basic-example"]
}

and when I run my build command I get this result :

D:\HashiCorp\Packer1.8.0\Project>packer build packer_test_win2022CARL.pkr.hcl
vmware-vmx.basic-example: output will be in this color.

==> vmware-vmx.basic-example: Configuring output and export directories...
==> vmware-vmx.basic-example: Creating required virtual machine disks
==> vmware-vmx.basic-example: Cloning source VM...
==> vmware-vmx.basic-example: Deleting output directory...
Build 'vmware-vmx.basic-example' errored after 521 milliseconds 605 microseconds: VMware error: Error: A file was not found

==> Wait completed after 521 milliseconds 605 microseconds

==> Some builds didn't complete successfully and had errors:
--> vmware-vmx.basic-example: VMware error: Error: A file was not found

==> Builds finished but no artifacts were created.

Solution

  • Solved, not enough to point the VMX file, VMware needs other files such as .vmdk, .vmxf etc ... to proceed with the cloning