diff --git a/.web-docs/components/builder/vsphere-clone/README.md b/.web-docs/components/builder/vsphere-clone/README.md index 4cfc8619e..0b6e579bf 100644 --- a/.web-docs/components/builder/vsphere-clone/README.md +++ b/.web-docs/components/builder/vsphere-clone/README.md @@ -1403,14 +1403,14 @@ Only use the `host` option. Optionally specify a `resource_pool`: **JSON** ```json -"host": "esxi-1.vsphere65.test", +"host": "esxi-01.example.com", "resource_pool": "pool1", ``` **HCL2** ```hcl -host = "esxi-1.vsphere65.test" +host = "esxi-01.example.com" resource_pool = "pool1" ``` @@ -1423,14 +1423,14 @@ Use the `cluster` and `host`parameters: ```json "cluster": "cluster1", -"host": "esxi-2.vsphere65.test", +"host": "esxi-02.example.com", ``` **HCL2** ```hcl cluster = "cluster1" -host = "esxi-2.vsphere65.test" +host = "esxi-02.example.com" ``` diff --git a/.web-docs/components/builder/vsphere-iso/README.md b/.web-docs/components/builder/vsphere-iso/README.md index ed9a66be5..86cada257 100644 --- a/.web-docs/components/builder/vsphere-iso/README.md +++ b/.web-docs/components/builder/vsphere-iso/README.md @@ -1415,14 +1415,14 @@ Only use the `host` option. Optionally specify a `resource_pool`: **JSON** ```json -"host": "esxi-1.vsphere65.test", +"host": "esxi-01.example.com", "resource_pool": "pool1", ``` **HCL2** ```hcl -host = ""esxi-1.vsphere65.test"" +host = ""esxi-01.example.com"" resource_pool = "pool1" ``` @@ -1435,14 +1435,14 @@ Use the `cluster` and `host`parameters: ```json "cluster": "cluster1", -"host": "esxi-2.vsphere65.test", +"host": "esxi-02.example.com", ``` **HCL2** ```hcl cluster = "cluster1" -host = "esxi-2.vsphere65.test" +host = "esxi-02.example.com" ``` @@ -1467,7 +1467,7 @@ resource_pool = "pool1" ## Required vSphere Privileges -It is recommended to create a custom vSphere role with the required privileges to integrate Packer with vSphere. Accounts or groups can be added to the role to ensure that Packer has **_the least privileged_** access to the infrastructure. For example, a named service account (_e.g._ svc-packer-vsphere@example.com). +It is recommended to create a custom vSphere role with the required privileges to integrate Packer with vSphere. Accounts or groups can be added to the role to ensure that Packer has **_the least privileged_** access to the infrastructure. For example, a named service account (_e.g._ svc-packer-vsphere@example.com). Clone the default **Read-Only** vSphere role and add the following privileges, which are based on the capabilities of the `vsphere-iso` plugin: diff --git a/CHANGELOG.md b/CHANGELOG.md index c89b235a8..ad3c75637 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,17 +3,21 @@ Please refer to [releases](https://github.com/hashicorp/packer-plugin-vsphere/releases) for the latest CHANGELOG information. --- + ## 1.0.2 (October 18, 2021) -### NOTES: +### NOTES + Support for the HCP Packer registry is currently in beta and requires Packer v1.7.7 [GH-115] [GH-120] -### FEATURES: +### FEATURES + * Add HCP Packer registry image metadata to all artifacts. [GH-115] [GH-120] -## IMPROVEMENTS: +## IMPROVEMENTS + * Add `floppy_content` parameter, which is similar to `http_content` and `cd_content`, but for floppy. [GH-117] * Add skip_import parameter in content_library_destination configuration. diff --git a/README.md b/README.md index 29e5c70e0..b26fa3230 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,7 @@ The plugin includes two builders which are able to create images, depending on y Learn more: [VMware Product Lifecycle Matrix][vmware-product-lifecycle-matrix] - > **Note** - > - > This plugin requires API write access and is therefore not supported for use with a free VMware vSphere Hypervisor license. - -* [Go 1.18][golang-install] +* [Go 1.19][golang-install] Required if building the plugin. @@ -50,7 +46,7 @@ packer { #### Manual Installation -You can download [pre-built binary releases][releases-vsphere-plugin] of the plugin on GitHub. Once you have downloaded the latest release archive for your target operating system and architecture, uncompress to retrieve the plugin binary file for your platform. +You can download [pre-built binary releases][releases-vsphere-plugin] of the plugin on GitHub. Once you have downloaded the latest release archive for your target operating system and architecture, extract the release archive to retrieve the plugin binary file for your platform. To install the downloaded plugin, please follow the Packer documentation on [installing a plugin][docs-packer-plugin-install]. diff --git a/builder/vsphere/clone/config_test.go b/builder/vsphere/clone/config_test.go index b70cb22cd..973925113 100644 --- a/builder/vsphere/clone/config_test.go +++ b/builder/vsphere/clone/config_test.go @@ -32,7 +32,7 @@ func TestCloneConfig_Timeout(t *testing.T) { warns, err := conf.Prepare(raw) testConfigOk(t, warns, err) if conf.ShutdownConfig.Timeout != 3*time.Minute { - t.Fatalf("shutdown_timeout sould be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout) + t.Fatalf("shutdown_timeout should be equal 3 minutes, got %v", conf.ShutdownConfig.Timeout) } } diff --git a/builder/vsphere/clone/step_clone_test.go b/builder/vsphere/clone/step_clone_test.go index 120141b18..cae4788ad 100644 --- a/builder/vsphere/clone/step_clone_test.go +++ b/builder/vsphere/clone/step_clone_test.go @@ -127,14 +127,14 @@ func TestCreateConfig_Prepare(t *testing.T) { errs := c.config.Prepare() if c.fail { if len(errs) == 0 { - t.Fatalf("Config preprare should fail") + t.Fatalf("Config prepare should fail") } if errs[0].Error() != c.expectedErrMsg { t.Fatalf("Expected error message: %s but was '%s'", c.expectedErrMsg, errs[0].Error()) } } else { if len(errs) != 0 { - t.Fatalf("Config preprare should not fail: %s", errs[0]) + t.Fatalf("Config prepare should not fail: %s", errs[0]) } } }) diff --git a/builder/vsphere/clone/step_customize.go b/builder/vsphere/clone/step_customize.go index f7fa3186b..b5a1d8e1d 100644 --- a/builder/vsphere/clone/step_customize.go +++ b/builder/vsphere/clone/step_customize.go @@ -167,7 +167,7 @@ func (c *CustomizeConfig) Prepare() ([]string, []error) { } if options_number > 1 { - errs = append(errs, errCustomizeOptionMutalExclusive) + errs = append(errs, errCustomizeOptionMutualExclusive) } else if options_number == 0 { errs = append(errs, fmt.Errorf("one of `linux_options`, `windows_options`, `windows_sysprep_file` must be set")) } diff --git a/builder/vsphere/clone/step_customize_test.go b/builder/vsphere/clone/step_customize_test.go index 6f8a914bd..579e7e1dd 100644 --- a/builder/vsphere/clone/step_customize_test.go +++ b/builder/vsphere/clone/step_customize_test.go @@ -22,7 +22,7 @@ func TestSysprepFieldsMutuallyExclusive(t *testing.T) { } // Expected error message - expectedError := errCustomizeOptionMutalExclusive + expectedError := errCustomizeOptionMutualExclusive _, errors := config.Prepare() // Make sure we only received on error diff --git a/builder/vsphere/common/hcp_metadata.go b/builder/vsphere/common/hcp_metadata.go index 6282b273a..d35837cc4 100644 --- a/builder/vsphere/common/hcp_metadata.go +++ b/builder/vsphere/common/hcp_metadata.go @@ -36,7 +36,7 @@ func GetVMMetadata(vm *driver.VirtualMachineDriver, state multistep.StateBag) ma p := vm.NewResourcePool(info.ResourcePool) poolPath, err := p.Path() if err == nil && poolPath != "" { - labels["resurce_pool"] = poolPath + labels["resource_pool"] = poolPath } } diff --git a/builder/vsphere/common/step_wait_for_ip.go b/builder/vsphere/common/step_wait_for_ip.go index 6895c23bf..217bf5bdb 100644 --- a/builder/vsphere/common/step_wait_for_ip.go +++ b/builder/vsphere/common/step_wait_for_ip.go @@ -159,7 +159,7 @@ loop: if prevIp == "" || prevIp != ip { if prevIp == "" { - log.Printf("VM IP aquired: %s", ip) + log.Printf("VM IP acquired: %s", ip) } else { log.Printf("VM IP changed from %s to %s", prevIp, ip) } diff --git a/builder/vsphere/common/testing/utility.go b/builder/vsphere/common/testing/utility.go index f743a5c43..fef79296f 100644 --- a/builder/vsphere/common/testing/utility.go +++ b/builder/vsphere/common/testing/utility.go @@ -45,7 +45,7 @@ func TestConn() (driver.Driver, error) { } d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: "vcenter.vsphere65.test", + VCenterServer: "vcenter.example.com", Username: username, Password: password, InsecureConnection: true, diff --git a/builder/vsphere/driver/datastore_acc_test.go b/builder/vsphere/driver/datastore_acc_test.go index a189903fb..a6a95f92f 100644 --- a/builder/vsphere/driver/datastore_acc_test.go +++ b/builder/vsphere/driver/datastore_acc_test.go @@ -29,7 +29,7 @@ func TestDatastoreAcc(t *testing.T) { func TestFileUpload(t *testing.T) { t.Skip("Acceptance tests not configured yet.") dsName := "datastore1" - hostName := "esxi-1.vsphere65.test" + hostName := "esxi-01.example.com" fileName := fmt.Sprintf("test-%v", time.Now().Unix()) tmpFile, err := os.CreateTemp("", fileName) diff --git a/builder/vsphere/driver/disk_test.go b/builder/vsphere/driver/disk_test.go index 682bae550..a50ce68db 100644 --- a/builder/vsphere/driver/disk_test.go +++ b/builder/vsphere/driver/disk_test.go @@ -29,7 +29,7 @@ func TestAddStorageDevices(t *testing.T) { noExistingDevices := object.VirtualDeviceList{} storageConfigSpec, err := config.AddStorageDevices(noExistingDevices) if err != nil { - t.Fatalf("unexpected erro: %q", err.Error()) + t.Fatalf("unexpected error: %q", err.Error()) } if len(storageConfigSpec) != 3 { t.Fatalf("Expecting VirtualDeviceList to have 3 storage devices but had %d", len(storageConfigSpec)) @@ -41,7 +41,7 @@ func TestAddStorageDevices(t *testing.T) { storageConfigSpec, err = config.AddStorageDevices(existingDevices) if err != nil { - t.Fatalf("unexpected erro: %q", err.Error()) + t.Fatalf("unexpected error: %q", err.Error()) } if len(storageConfigSpec) != 3 { t.Fatalf("Expecting VirtualDeviceList to have 3 storage devices but had %d", len(storageConfigSpec)) diff --git a/builder/vsphere/driver/driver_test.go b/builder/vsphere/driver/driver_test.go index fa39a267a..ffac08586 100644 --- a/builder/vsphere/driver/driver_test.go +++ b/builder/vsphere/driver/driver_test.go @@ -24,7 +24,7 @@ import ( ) // Defines whether acceptance tests should be run -const TestHostName = "esxi-1.vsphere65.test" +const TestHostName = "esxi-01.example.com" func newTestDriver(t *testing.T) Driver { username := os.Getenv("VSPHERE_USERNAME") @@ -37,7 +37,7 @@ func newTestDriver(t *testing.T) Driver { } d, err := NewDriver(&ConnectConfig{ - VCenterServer: "vcenter.vsphere65.test", + VCenterServer: "vcenter.example.com", Username: username, Password: password, InsecureConnection: true, diff --git a/builder/vsphere/driver/library.go b/builder/vsphere/driver/library.go index 74c900fc9..5e5a932c2 100644 --- a/builder/vsphere/driver/library.go +++ b/builder/vsphere/driver/library.go @@ -108,7 +108,7 @@ func (l *LibraryFilePath) Validate() error { l.path = strings.TrimLeft(l.path, "/") parts := strings.Split(l.path, "/") if len(parts) != 3 { - return fmt.Errorf("Not a valid Content Library File path. The path must contain the nanmes for the library, item and file.") + return fmt.Errorf("invalid content library file path. path must contain the names for the library, item, and file.") } return nil } diff --git a/builder/vsphere/driver/resource_pool_acc_test.go b/builder/vsphere/driver/resource_pool_acc_test.go index d2372838a..bc87933a4 100644 --- a/builder/vsphere/driver/resource_pool_acc_test.go +++ b/builder/vsphere/driver/resource_pool_acc_test.go @@ -8,7 +8,7 @@ import "testing" func TestResourcePoolAcc(t *testing.T) { t.Skip("Acceptance tests not configured yet.") d := newTestDriver(t) - p, err := d.FindResourcePool("", "esxi-1.vsphere65.test", "pool1/pool2") + p, err := d.FindResourcePool("", "esxi-01.example.com", "pool1/pool2") if err != nil { t.Fatalf("Cannot find the default resource pool '%v': %v", "pool1/pool2", err) } diff --git a/builder/vsphere/driver/vm.go b/builder/vsphere/driver/vm.go index 24835b18d..5d0456a69 100644 --- a/builder/vsphere/driver/vm.go +++ b/builder/vsphere/driver/vm.go @@ -168,12 +168,12 @@ func (d *VCenterDriver) PreCleanVM(ui packersdk.Ui, vmPath string, force bool, v // covert to a vm if it is a template so it can be deleted isTemplate, err := vm.IsTemplate() if err != nil { - return fmt.Errorf("error determing if the vm is a template%s: %v", vmPath, err) + return fmt.Errorf("error determining if the vm is a template%s: %v", vmPath, err) } else if isTemplate { ui.Say(fmt.Sprintf("%s is a template, attempting to convert it to a vm", vmPath)) err := vm.ConvertToVirtualMachine(vsphereCluster, vsphereHost, vsphereResourcePool) if err != nil { - return fmt.Errorf("error convertng template back to virtual machine for cleanup %s: %v", vmPath, err) + return fmt.Errorf("error converting template back to virtual machine for cleanup %s: %v", vmPath, err) } } @@ -316,7 +316,7 @@ func (vm *VirtualMachineDriver) FloppyDevices() (object.VirtualDeviceList, error func (vm *VirtualMachineDriver) Clone(ctx context.Context, config *CloneConfig) (VirtualMachine, error) { folder, err := vm.driver.FindFolder(config.Folder) if err != nil { - return nil, fmt.Errorf("Error finding filder: %s", err) + return nil, fmt.Errorf("Error finding folder: %s", err) } var relocateSpec types.VirtualMachineRelocateSpec @@ -1062,7 +1062,7 @@ func findNetwork(network string, host string, d *VCenterDriver) (object.NetworkR return object.NewNetwork(d.client.Client, i.Network[0]), nil } - return nil, fmt.Errorf("Couldn't find network; 'host' and 'network' not specified. At least one of the two must be specified.") + return nil, fmt.Errorf("error finding network; 'host' and 'network' not specified. at least one of the two must be specified.") } func newVGPUProfile(vGPUProfile string) types.VirtualPCIPassthrough { diff --git a/builder/vsphere/driver/vm_clone_acc_test.go b/builder/vsphere/driver/vm_clone_acc_test.go index e744b66d8..5aa8923b8 100644 --- a/builder/vsphere/driver/vm_clone_acc_test.go +++ b/builder/vsphere/driver/vm_clone_acc_test.go @@ -43,7 +43,7 @@ func TestVMAcc_clone(t *testing.T) { t.Fatalf("Cannot find template vm '%v': %v", templateName, err) } - log.Printf("[DEBUG] Clonning VM") + log.Printf("[DEBUG] Cloning VM") vm, err := template.Clone(context.TODO(), tc.config) if err != nil { t.Fatalf("Cannot clone vm '%v': %v", templateName, err) @@ -170,7 +170,7 @@ func configureCheck(t *testing.T, vm VirtualMachine, _ *CloneConfig) { memoryHotAdd := vmInfo.Config.MemoryHotAddEnabled if *memoryHotAdd != hwConfig.MemoryHotAddEnabled { - t.Errorf("VM should have Memroy hot add set to %v, got %v", hwConfig.MemoryHotAddEnabled, memoryHotAdd) + t.Errorf("VM should have memory hot add set to %v, got %v", hwConfig.MemoryHotAddEnabled, memoryHotAdd) } } @@ -253,7 +253,7 @@ func startAndStopCheck(t *testing.T, vm VirtualMachine, config *CloneConfig) { log.Printf("[DEBUG] Waiting max 1m0s for shutdown to complete") err = vm.WaitForShutdown(context.TODO(), 1*time.Minute) if err != nil { - t.Fatalf("Failed to wait for giest shutdown: %v", err) + t.Fatalf("Failed to wait for guest shutdown: %v", err) } } diff --git a/builder/vsphere/examples/alpine/alpine-3.8.json b/builder/vsphere/examples/alpine/alpine-3.8.json index f16895dcc..88f566e4b 100644 --- a/builder/vsphere/examples/alpine/alpine-3.8.json +++ b/builder/vsphere/examples/alpine/alpine-3.8.json @@ -29,7 +29,7 @@ "{{template_dir}}/setup.sh" ], "guest_os_type": "other3xLinux64Guest", - "host": "esxi-1.vsphere65.test", + "host": "esxi-01.example.com", "insecure_connection": true, "iso_paths": [ "[datastore1] ISO/alpine-standard-3.8.2-x86_64.iso" @@ -49,7 +49,7 @@ } ], "username": "root", - "vcenter_server": "vcenter.vsphere65.test", + "vcenter_server": "vcenter.example.com", "vm_name": "alpine-{{timestamp}}" } ], @@ -61,4 +61,4 @@ "type": "shell" } ] -} \ No newline at end of file +} diff --git a/builder/vsphere/examples/alpine/alpine-3.8.pkr.hcl b/builder/vsphere/examples/alpine/alpine-3.8.pkr.hcl index 19b3b4d36..c9d8e61c1 100644 --- a/builder/vsphere/examples/alpine/alpine-3.8.pkr.hcl +++ b/builder/vsphere/examples/alpine/alpine-3.8.pkr.hcl @@ -17,7 +17,7 @@ source "vsphere-iso" "autogenerated_1" { disk_controller_type = ["pvscsi"] floppy_files = ["${path.root}/answerfile", "${path.root}/setup.sh"] guest_os_type = "other3xLinux64Guest" - host = "esxi-1.vsphere65.test" + host = "esxi-01.example.com" insecure_connection = true iso_paths = ["[datastore1] ISO/alpine-standard-3.8.2-x86_64.iso"] network_adapters { @@ -31,7 +31,7 @@ source "vsphere-iso" "autogenerated_1" { disk_thin_provisioned = true } username = "root" - vcenter_server = "vcenter.vsphere65.test" + vcenter_server = "vcenter.example.com" vm_name = "alpine-${local.timestamp}" } diff --git a/builder/vsphere/examples/clone/alpine.json b/builder/vsphere/examples/clone/alpine.json index 8e62d2726..885183db8 100644 --- a/builder/vsphere/examples/clone/alpine.json +++ b/builder/vsphere/examples/clone/alpine.json @@ -3,14 +3,14 @@ { "type": "vsphere-clone", - "vcenter_server": "vcenter.vsphere65.test", + "vcenter_server": "vcenter.example.com", "username": "root", "password": "jetbrains", "insecure_connection": "true", "template": "alpine", "vm_name": "alpine-clone-{{timestamp}}", - "host": "esxi-1.vsphere65.test", + "host": "esxi-01.example.com", "communicator": "none" } diff --git a/builder/vsphere/examples/clone/alpine.pkr.hcl b/builder/vsphere/examples/clone/alpine.pkr.hcl index dd72f7cbb..4df5415d6 100644 --- a/builder/vsphere/examples/clone/alpine.pkr.hcl +++ b/builder/vsphere/examples/clone/alpine.pkr.hcl @@ -10,12 +10,12 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } # https://www.packer.io/docs/templates/hcl_templates/blocks/source source "vsphere-clone" "example_clone" { communicator = "none" - host = "esxi-1.vsphere65.test" + host = "esxi-01.example.com" insecure_connection = "true" password = "jetbrains" template = "alpine" username = "root" - vcenter_server = "vcenter.vsphere65.test" + vcenter_server = "vcenter.example.com" vm_name = "alpine-clone-${local.timestamp}" } diff --git a/builder/vsphere/examples/driver/main.go b/builder/vsphere/examples/driver/main.go index 0955acb9a..46d65d384 100644 --- a/builder/vsphere/examples/driver/main.go +++ b/builder/vsphere/examples/driver/main.go @@ -11,7 +11,7 @@ import ( func main() { d, err := driver.NewDriver(&driver.ConnectConfig{ - VCenterServer: "vcenter.vsphere65.test", + VCenterServer: "vcenter.example.com", Username: "root", Password: "jetbrains", InsecureConnection: true, @@ -20,7 +20,7 @@ func main() { panic(err) } - ds, err := d.FindDatastore("", "esxi-1.vsphere65.test") + ds, err := d.FindDatastore("", "esxi-01.example.com") if err != nil { panic(err) } diff --git a/builder/vsphere/examples/macos/macos-10.13.json b/builder/vsphere/examples/macos/macos-10.13.json index 22a02374d..20c5cf63f 100644 --- a/builder/vsphere/examples/macos/macos-10.13.json +++ b/builder/vsphere/examples/macos/macos-10.13.json @@ -16,7 +16,7 @@ "smc.present": "TRUE" }, "guest_os_type": "darwin16_64Guest", - "host": "esxi-mac.vsphere65.test", + "host": "esxi-mac.vsphere65esxi-02.example.com", "insecure_connection": "true", "iso_checksum": "file:///{{template_dir}}/setup/out/sha256sums", "iso_paths": [ @@ -42,8 +42,8 @@ ], "usb_controller": true, "username": "root", - "vcenter_server": "vcenter.vsphere65.test", + "vcenter_server": "vcenter.example.com", "vm_name": "macos-packer" } ] -} \ No newline at end of file +} diff --git a/builder/vsphere/examples/macos/macos-10.13.pkr.hcl b/builder/vsphere/examples/macos/macos-10.13.pkr.hcl index b2637c0d8..951b43c60 100644 --- a/builder/vsphere/examples/macos/macos-10.13.pkr.hcl +++ b/builder/vsphere/examples/macos/macos-10.13.pkr.hcl @@ -33,7 +33,7 @@ source "vsphere-iso" "example_osx" { } usb_controller = ["usb"] username = "root" - vcenter_server = "vcenter.vsphere65.test" + vcenter_server = "vcenter.example.com" vm_name = "macos-packer" } diff --git a/builder/vsphere/examples/ubuntu/ubuntu-16.04.json b/builder/vsphere/examples/ubuntu/ubuntu-16.04.json index f5c87b2c5..5abd2fab4 100644 --- a/builder/vsphere/examples/ubuntu/ubuntu-16.04.json +++ b/builder/vsphere/examples/ubuntu/ubuntu-16.04.json @@ -28,7 +28,7 @@ "{{template_dir}}/preseed.cfg" ], "guest_os_type": "ubuntu64Guest", - "host": "esxi-1.vsphere65.test", + "host": "esxi-01.example.com", "insecure_connection": true, "iso_paths": [ "[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso" @@ -48,7 +48,7 @@ } ], "username": "root", - "vcenter_server": "vcenter.vsphere65.test", + "vcenter_server": "vcenter.example.com", "vm_name": "example-ubuntu" } ], @@ -60,4 +60,4 @@ "type": "shell" } ] -} \ No newline at end of file +} diff --git a/builder/vsphere/examples/ubuntu/ubuntu-16.04.pkr.hcl b/builder/vsphere/examples/ubuntu/ubuntu-16.04.pkr.hcl index fea3c68b5..e39dc3397 100644 --- a/builder/vsphere/examples/ubuntu/ubuntu-16.04.pkr.hcl +++ b/builder/vsphere/examples/ubuntu/ubuntu-16.04.pkr.hcl @@ -25,7 +25,7 @@ source "vsphere-iso" "example" { disk_controller_type = ["pvscsi"] floppy_files = ["${path.root}/preseed.cfg"] guest_os_type = "ubuntu64Guest" - host = "esxi-1.vsphere65.test" + host = "esxi-01.example.com" insecure_connection = true iso_paths = ["[datastore1] ISO/ubuntu-16.04.3-server-amd64.iso"] network_adapters { @@ -39,7 +39,7 @@ source "vsphere-iso" "example" { disk_thin_provisioned = true } username = "root" - vcenter_server = "vcenter.vsphere65.test" + vcenter_server = "vcenter.example.com" vm_name = "example-ubuntu" } diff --git a/builder/vsphere/examples/windows/windows-10.json b/builder/vsphere/examples/windows/windows-10.json index e9df38503..482382196 100644 --- a/builder/vsphere/examples/windows/windows-10.json +++ b/builder/vsphere/examples/windows/windows-10.json @@ -12,7 +12,7 @@ ], "floppy_img_path": "[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp", "guest_os_type": "windows9_64Guest", - "host": "esxi-1.vsphere65.test", + "host": "esxi-01.example.com", "insecure_connection": "true", "iso_paths": [ "[datastore1] ISO/en_windows_10_multi-edition_vl_version_1709_updated_dec_2017_x64_dvd_100406172.iso", @@ -31,7 +31,7 @@ } ], "username": "root", - "vcenter_server": "vcenter.vsphere65.test", + "vcenter_server": "vcenter.example.com", "vm_name": "example-windows", "winrm_password": "jetbrains", "winrm_username": "jetbrains" @@ -45,4 +45,4 @@ "type": "windows-shell" } ] -} \ No newline at end of file +} diff --git a/builder/vsphere/examples/windows/windows-10.pkr.hcl b/builder/vsphere/examples/windows/windows-10.pkr.hcl index 6b164fe00..c56f427ea 100644 --- a/builder/vsphere/examples/windows/windows-10.pkr.hcl +++ b/builder/vsphere/examples/windows/windows-10.pkr.hcl @@ -14,7 +14,7 @@ source "vsphere-iso" "example_windows" { floppy_files = ["${path.root}/setup/"] floppy_img_path = "[datastore1] ISO/VMware Tools/10.2.0/pvscsi-Windows8.flp" guest_os_type = "windows9_64Guest" - host = "esxi-1.vsphere65.test" + host = "esxi-01.example.com" insecure_connection = "true" iso_paths = ["[datastore1] ISO/en_windows_10_multi-edition_vl_version_1709_updated_dec_2017_x64_dvd_100406172.iso", "[datastore1] ISO/VMware Tools/10.2.0/windows.iso"] network_adapters { @@ -26,7 +26,7 @@ source "vsphere-iso" "example_windows" { disk_thin_provisioned = true } username = "root" - vcenter_server = "vcenter.vsphere65.test" + vcenter_server = "vcenter.example.com" vm_name = "example-windows" winrm_password = "jetbrains" winrm_username = "jetbrains" diff --git a/builder/vsphere/iso/builder_acc_test.go b/builder/vsphere/iso/builder_acc_test.go index 2d1285b2d..6a277ded0 100644 --- a/builder/vsphere/iso/builder_acc_test.go +++ b/builder/vsphere/iso/builder_acc_test.go @@ -50,12 +50,12 @@ func defaultConfig() map[string]interface{} { vcenter := os.Getenv("VSPHERE_VCENTER_SERVER") if vcenter == "" { - vcenter = "vcenter.vsphere65.test" + vcenter = "vcenter.example.com" } host := os.Getenv("VSPHERE_HOST") if host == "" { - host = "esxi-1.vsphere65.test" + host = "esxi-01.example.com" } config := map[string]interface{}{ @@ -473,7 +473,7 @@ func checkNetworkCard(name string) error { return fmt.Errorf("Cannot find the network card") } if len(netCards) > 1 { - return fmt.Errorf("Found several network catds") + return fmt.Errorf("Found several network cards") } if _, ok := netCards[0].(*types.VirtualVmxnet3); !ok { return fmt.Errorf("The network card type is not the expected one (vmxnet3)") @@ -554,13 +554,13 @@ func fullConfig() map[string]interface{} { } config := map[string]interface{}{ - "vcenter_server": "vcenter.vsphere65.test", + "vcenter_server": "vcenter.example.com", "username": username, "password": password, "insecure_connection": true, "vm_name": commonT.NewVMName(), - "host": "esxi-1.vsphere65.test", + "host": "esxi-01.example.com", "RAM": 512, "disk_controller_type": []string{ @@ -695,7 +695,7 @@ func checkBootOrder(name string) error { func TestISOBuilderAcc_cluster(t *testing.T) { config := defaultConfig() config["cluster"] = "cluster1" - config["host"] = "esxi-2.vsphere65.test" + config["host"] = "esxi-02.example.com" testCase := &acctest.PluginTestCase{ Name: "vsphere-iso_bootOrder_test", Template: commonT.RenderConfig("vsphere-iso", config), diff --git a/builder/vsphere/iso/step_create_test.go b/builder/vsphere/iso/step_create_test.go index f3bcdf3d2..fa1a25423 100644 --- a/builder/vsphere/iso/step_create_test.go +++ b/builder/vsphere/iso/step_create_test.go @@ -31,7 +31,7 @@ func TestCreateConfig_Prepare(t *testing.T) { }, } if errs := config.Prepare(); len(errs) != 0 { - t.Fatalf("Config preprare should not fail: %s", errs[0]) + t.Fatalf("Config prepare should not fail: %s", errs[0]) } if config.GuestOSType != "otherGuest" { t.Fatalf("GuestOSType should default to 'otherGuest'") @@ -185,14 +185,14 @@ func TestCreateConfig_Prepare(t *testing.T) { errs := c.config.Prepare() if c.fail { if len(errs) == 0 { - t.Fatalf("Config preprare should fail") + t.Fatalf("Config prepare should fail") } if errs[0].Error() != c.expectedErrMsg { t.Fatalf("Expected error message: %s but was '%s'", c.expectedErrMsg, errs[0].Error()) } } else { if len(errs) != 0 { - t.Fatalf("Config preprare should not fail: %s", errs[0]) + t.Fatalf("Config prepare should not fail: %s", errs[0]) } } } diff --git a/docs/builders/vsphere-clone.mdx b/docs/builders/vsphere-clone.mdx index ea3de5bc4..7bf696eed 100644 --- a/docs/builders/vsphere-clone.mdx +++ b/docs/builders/vsphere-clone.mdx @@ -298,14 +298,14 @@ Only use the `host` option. Optionally specify a `resource_pool`: **JSON** ```json -"host": "esxi-1.vsphere65.test", +"host": "esxi-01.example.com", "resource_pool": "pool1", ``` **HCL2** ```hcl -host = "esxi-1.vsphere65.test" +host = "esxi-01.example.com" resource_pool = "pool1" ``` @@ -318,14 +318,14 @@ Use the `cluster` and `host`parameters: ```json "cluster": "cluster1", -"host": "esxi-2.vsphere65.test", +"host": "esxi-02.example.com", ``` **HCL2** ```hcl cluster = "cluster1" -host = "esxi-2.vsphere65.test" +host = "esxi-02.example.com" ``` diff --git a/docs/builders/vsphere-iso.mdx b/docs/builders/vsphere-iso.mdx index b363f9e27..8c15f90ef 100644 --- a/docs/builders/vsphere-iso.mdx +++ b/docs/builders/vsphere-iso.mdx @@ -287,14 +287,14 @@ Only use the `host` option. Optionally specify a `resource_pool`: **JSON** ```json -"host": "esxi-1.vsphere65.test", +"host": "esxi-01.example.com", "resource_pool": "pool1", ``` **HCL2** ```hcl -host = ""esxi-1.vsphere65.test"" +host = ""esxi-01.example.com"" resource_pool = "pool1" ``` @@ -307,14 +307,14 @@ Use the `cluster` and `host`parameters: ```json "cluster": "cluster1", -"host": "esxi-2.vsphere65.test", +"host": "esxi-02.example.com", ``` **HCL2** ```hcl cluster = "cluster1" -host = "esxi-2.vsphere65.test" +host = "esxi-02.example.com" ``` @@ -339,7 +339,7 @@ resource_pool = "pool1" ## Required vSphere Privileges -It is recommended to create a custom vSphere role with the required privileges to integrate Packer with vSphere. Accounts or groups can be added to the role to ensure that Packer has **_the least privileged_** access to the infrastructure. For example, a named service account (_e.g._ svc-packer-vsphere@example.com). +It is recommended to create a custom vSphere role with the required privileges to integrate Packer with vSphere. Accounts or groups can be added to the role to ensure that Packer has **_the least privileged_** access to the infrastructure. For example, a named service account (_e.g._ svc-packer-vsphere@example.com). Clone the default **Read-Only** vSphere role and add the following privileges, which are based on the capabilities of the `vsphere-iso` plugin: diff --git a/post-processor/vsphere/artifact_test.go b/post-processor/vsphere/artifact_test.go index bffce287f..ff4d0d22a 100644 --- a/post-processor/vsphere/artifact_test.go +++ b/post-processor/vsphere/artifact_test.go @@ -20,6 +20,6 @@ func TestArtifact_ImplementsArtifact(t *testing.T) { func TestArtifact_Id(t *testing.T) { artifact := NewArtifact("datastore", "vmfolder", "vmname", nil) if artifact.Id() != "datastore::vmfolder::vmname" { - t.Fatalf("must return datastore, vmfolder and vmname splitted by :: as Id") + t.Fatalf("must return datastore, vmfolder, and vmname split by :: as id") } } diff --git a/post-processor/vsphere/post-processor_test.go b/post-processor/vsphere/post-processor_test.go index bae163ad8..0fdff419e 100644 --- a/post-processor/vsphere/post-processor_test.go +++ b/post-processor/vsphere/post-processor_test.go @@ -61,7 +61,7 @@ func TestGenerateURI_Basic(t *testing.T) { } expected_uri := "vi://me:notpassword@myhost/mydc/host/mycluster" if uri.String() != expected_uri { - t.Fatalf("URI did not match. Recieved: %s. Expected: %s", uri, expected_uri) + t.Fatalf("URI did not match. Received: %s. Expected: %s", uri, expected_uri) } } @@ -73,7 +73,7 @@ func TestGenerateURI_PasswordEscapes(t *testing.T) { cases := []escapeCases{ {`this has spaces`, `this%20has%20spaces`}, - {`exclaimation_!`, `exclaimation_%21`}, + {`exclamation_!`, `exclamation_%21`}, {`hash_#_dollar_$`, `hash_%23_dollar_$`}, {`ampersand_&awesome`, `ampersand_&awesome`}, {`single_quote_'_and_another_'`, `single_quote_%27_and_another_%27`}, @@ -100,7 +100,7 @@ func TestGenerateURI_PasswordEscapes(t *testing.T) { expected_uri := fmt.Sprintf("vi://me:%s@myhost/mydc/host/mycluster", escapeCase.Expected) if uri.String() != expected_uri { - t.Fatalf("URI did not match. Recieved: %s. Expected: %s", uri, expected_uri) + t.Fatalf("URI did not match. Received: %s. Expected: %s", uri, expected_uri) } } } @@ -119,7 +119,7 @@ func TestGetEncodedPassword(t *testing.T) { t.Fatalf("Password is set but test said it is not") } if encoded != expected { - t.Fatalf("Should have successfully gotten encoded password. Expected: %s; recieved: %s", expected, encoded) + t.Fatalf("Should have successfully gotten encoded password. Expected: %s; received: %s", expected, encoded) } // There is no password