45 lines
1.2 KiB
HCL
45 lines
1.2 KiB
HCL
resource "vsphere_virtual_machine" "TF-SRV01" {
|
|
name = "TF-SRV01"
|
|
resource_pool_id = data.vsphere_resource_pool.pool.id
|
|
datastore_id = data.vsphere_datastore.vmdatastore.id
|
|
folder = var.vsphere_vmfolder
|
|
|
|
num_cpus = 2
|
|
memory = 4096
|
|
|
|
network_interface {
|
|
network_id = data.vsphere_network.network.id
|
|
}
|
|
|
|
disk {
|
|
label = "disk0"
|
|
unit_number = 0
|
|
size = 40
|
|
thin_provisioned = true
|
|
}
|
|
disk {
|
|
label = "disk1"
|
|
unit_number = 1
|
|
size = 25
|
|
thin_provisioned = true
|
|
}
|
|
|
|
vapp {
|
|
properties = {
|
|
"guestinfo.hostname" = "TF-SRV01"
|
|
"guestinfo.ipaddress" = "10.0.0.42"
|
|
"guestinfo.prefixlength" = "24"
|
|
"guestinfo.dnsserver" = "10.0.0.5"
|
|
"guestinfo.gateway" = "10.0.0.1"
|
|
}
|
|
}
|
|
|
|
clone {
|
|
template_uuid = vsphere_content_library_item.Server2019.id
|
|
}
|
|
|
|
# # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
|
|
# lifecycle {
|
|
# prevent_destroy = true
|
|
# }
|
|
} |