2022-03-03 12:37:36 +00:00
|
|
|
resource "vsphere_virtual_machine" "vm-srv" {
|
|
|
|
name = "TF-SRV01"
|
|
|
|
|
|
|
|
num_cpus = var.vm_numcpu
|
|
|
|
memory = var.vm_memory
|
|
|
|
|
|
|
|
folder = var.hv_vmfolder
|
|
|
|
|
2022-03-03 12:41:26 +00:00
|
|
|
guest_id = var.vm_guestid
|
2022-03-03 12:37:36 +00:00
|
|
|
resource_pool_id = data.vsphere_resource_pool.pool.id
|
|
|
|
datastore_id = data.vsphere_datastore.datastore.id
|
|
|
|
host_system_id = data.vsphere_host.host.id
|
|
|
|
|
|
|
|
network_interface {
|
|
|
|
network_id = data.vsphere_network.network.id
|
|
|
|
}
|
|
|
|
wait_for_guest_net_timeout = 15
|
|
|
|
|
|
|
|
disk {
|
|
|
|
label = "disk0"
|
|
|
|
unit_number = 0
|
|
|
|
size = 40
|
|
|
|
thin_provisioned = true
|
|
|
|
}
|
|
|
|
disk {
|
|
|
|
label = "disk1"
|
|
|
|
unit_number = 1
|
|
|
|
size = 25
|
|
|
|
thin_provisioned = true
|
|
|
|
}
|
|
|
|
|
|
|
|
clone {
|
|
|
|
template_uuid = data.vsphere_virtual_machine.template.id
|
|
|
|
}
|
|
|
|
// # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
|
|
|
|
// lifecycle {
|
|
|
|
// prevent_destroy = true
|
|
|
|
// }
|
|
|
|
}
|