Reputation: 430
I'm trying to create and customize my infrastructure that have Windows VMs, using terraform. The provider is VMWare vSphere. The VM creation is done properly but the customization inside the client machines are not. My configuration looks like:
resource "vsphere_virtual_machine" "vm" {
count = "2"
name = "${var.virtual_machine_name_prefix}${count.index}"
resource_pool_id = "${data.vsphere_resource_pool.resource_pool.id}"
host_system_id = "${data.vsphere_host.host.*.id[count.index]}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
folder = "my-vm-folder"
num_cpus = 8
memory = 8192
guest_id = "${data.vsphere_virtual_machine.template.guest_id}"
scsi_type = "${data.vsphere_virtual_machine.template.scsi_type}"
network_interface {
# label = "${data.vsphere_network.network.name}"
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
}
disk {
label = "disk0"
size = "${data.vsphere_virtual_machine.template.disks.0.size}"
}
clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"
customize {
windows_options {
computer_name = "${var.virtual_machine_name_prefix}${count.index}"
full_name = "${var.virtual_machine_name_prefix}${count.index}"
organization_name = "myorg"
join_domain = "mydomain.com"
domain_admin_user = "admin"
domain_admin_password = "P@ssword"
}
network_interface {
dns_server_list = ["${var.virtual_machine_dns_servers}"]
}
}
}
}
Whenever I try to create, the error message I get is:
* vsphere_virtual_machine.vm[1]: 1 error(s) occurred:
* vsphere_virtual_machine.vm.1:
Virtual machine customization failed on "/foldername/vm-name-1":
timeout waiting for customization to complete
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
It looks like terraform is not able to communicate with the client VM which causes the timeout. Is there anything else that I need to provide to terraform to work into it?
Upvotes: 3
Views: 2640
Reputation: 43
If "Windows Setup could not configure Windows to run on this computer's hardware" is displayed on the VM screen when the customization fails, It might be sysprep that is bugging.
Upvotes: 0