Hi there!
I’m new to Terraform so I 'd like to get verified that I get legit results. VM is being cloned for around 2 minutes and then it’s being configured for another 7 (!!) minutes during which it’s being restarted 3 times. Is it correct behavior? Is there a way to reduce number of restarts? AFAIK there is no need to restart machine to configure network interface so in my opinion there should be just one restart to set computer_name
I use this code to set up the vm:
resource "vsphere_virtual_machine" "win-slaves" {
count = "${length(var.win_slaves_ips)}"
name = "${local.win_slaves_name_prefix}-${count.index + 1}"
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"
folder = vsphere_folder.folder.path
num_cpus = 2
memory = 2048
guest_id = "${data.vsphere_virtual_machine.win_template.guest_id}"
scsi_type = "${data.vsphere_virtual_machine.win_template.scsi_type}"
enable_disk_uuid = true
disk {
label = "disk0"
size = "${data.vsphere_virtual_machine.win_template.disks.0.size}"
eagerly_scrub = "${data.vsphere_virtual_machine.win_template.disks.0.eagerly_scrub}"
thin_provisioned = "${data.vsphere_virtual_machine.win_template.disks.0.thin_provisioned}"
}
network_interface {
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.win_template.network_interface_types[0]}"
}
clone {
template_uuid = "${data.vsphere_virtual_machine.win_template.id}"
linked_clone = false
customize {
windows_options {
computer_name = "${var.cluster_name}-win-slave"
admin_password = "secret"
}
network_interface {
ipv4_address = "${var.win_slaves_ips[0]}"
ipv4_netmask = 24
dns_server_list = ["${var.guest_primary_dns}", "${var.guest_secondary_dns}"]
}
ipv4_gateway = "${var.guest_default_gateway}"
}
}
}