Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Terraform VMware vSphere Virtual Machine customization clone failed on Windows

While doing project on Terraform with VMware vSphere: Terraform module clone VMware vSphere Linux and Windows virtual machine, I was receiving below error while deployment. VM was getting deployed but VM customization was running into error and failing.

Error: 
│ Virtual machine customization failed on "/Asgard/vm/os-windows":
│
│ An error occurred while customizing VM os-windows. For details reference the log file C:/Windows/TEMP/vmware-imc/guestcust.log in the guest OS.
│
│ The virtual machine has not been deleted to assist with troubleshooting. If
│ corrective steps are taken without modifying the "customize" block of the
│ resource configuration, the resource will need to be tainted before trying
│ again. For more information on how to do this, see the following page:
│ https://www.terraform.io/docs/commands/taint.html
│
│
│   with module.virtual_machine["server02"].vsphere_virtual_machine.windowsvm[0],
│   on modules\vsphere_vm\main.tf line 64, in resource "vsphere_virtual_machine" "windowsvm":
│   64: resource "vsphere_virtual_machine" "windowsvm" {
│

In actual VM is cloned but when you see cloned new Virtual Machine configuration, it is half cooked VM, network adapter is disconnected as network customization has not happened properly. 

This is specifically happens to cloned windows VMs. For this solution is source VMware Windows Template which you are going to clone should not be already sysprep 'ed. As Terraform will do the sysprep in the code in customization section Using terraform to clone a virtual machine on VMware vSphere infrastructure.

The main reason is When Terraform is doing the customization, sysprep'ed VM is restarted multiple times, which breaks the terraform process.

Useful Articles
VMWARE VSPHERE UPDATE MANAGER (VUM) - IMPORTING ESXI ISO AND CREATE UPGRADE BASELINE 
VMWARE VSPHERE UPDATE MANAGER (VUM) - UPGRADE ESXI OS 
ESXi 6.0 update offline bundle via esxcli commandline: DependencyError VIB bootbank requires VSAN ImageProfile
ESXi 6.5 upgrade bundle via command line: No Space Left On Device Error
Registering HPE ILO amplifier pack (Hardware support manager) with vCenter 7 Lifecycle manager
VMware LifeCycle Manager import updates bundle and patch ESXi server
How to update a patch on an ESXi host via command line
Add a Trusted Root Certificate to the Certificate Store VMware Photon OS
Patching update VMware vCenter Server Appliance from a zipped update bundle Web server
Powershell GUI VMware ESXi custom patch bundle builder
Create a custom TCPIP stack on ESXi server - VMware PowerCLI GUI

Go Back



Comment

Blog Search

Page Views

8559487

Follow me on Blogarama