39 lines
1.1 KiB
Terraform
39 lines
1.1 KiB
Terraform
|
resource "vsphere_virtual_machine" "vm-srv" {
|
||
|
name = "TF-SRV01"
|
||
|
|
||
|
num_cpus = var.vm_numcpu
|
||
|
memory = var.vm_memory
|
||
|
|
||
|
folder = var.hv_vmfolder
|
||
|
|
||
|
// guest_id = data.vsphere_ovf_vm_template.ovf-srv.guest_id
|
||
|
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
|
||
|
// }
|
||
|
}
|