diff --git a/builder/vsphere/common/step_add_cdrom.go b/builder/vsphere/common/step_add_cdrom.go index 749efce5..d7654b1d 100644 --- a/builder/vsphere/common/step_add_cdrom.go +++ b/builder/vsphere/common/step_add_cdrom.go @@ -74,7 +74,9 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste } if path, ok := state.GetOk("iso_remote_path"); ok { - s.Config.ISOPaths = append(s.Config.ISOPaths, path.(string)) + // The order matters: docs say "iso_url" should go first, so make sure to + // prepend it. + s.Config.ISOPaths = append([]string{path.(string)}, s.Config.ISOPaths...) } // Add our custom CD, if it exists diff --git a/builder/vsphere/common/step_add_cdrom_test.go b/builder/vsphere/common/step_add_cdrom_test.go index 1fc808dd..18018cfd 100644 --- a/builder/vsphere/common/step_add_cdrom_test.go +++ b/builder/vsphere/common/step_add_cdrom_test.go @@ -96,7 +96,7 @@ func TestStepAddCDRom_Run(t *testing.T) { FindSATAControllerCalled: true, AddCdromCalledTimes: 3, AddCdromTypes: []string{"sata", "sata", "sata"}, - AddCdromPaths: []string{"iso/path", "remote/path", "cd/path"}, + AddCdromPaths: []string{"remote/path", "iso/path", "cd/path"}, }, fail: false, errMessage: "",