57 lines
1.6 KiB
HCL
57 lines
1.6 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 = {
|
|
# "deployment.type" = "standalone"
|
|
|
|
"guestinfo.hostname" = "TF-SRV01"
|
|
# "guestinfo.administratorpw" = "Secret123!"
|
|
# "guestinfo.ntpserver" = "0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org"
|
|
"guestinfo.ipaddress" = "10.0.0.42"
|
|
"guestinfo.prefixlength" = "24"
|
|
"guestinfo.dnsserver" = "10.0.0.21"
|
|
"guestinfo.gateway" = "10.0.0.1"
|
|
|
|
"addsconfig.domainname" = "srv.io"
|
|
"addsconfig.username" = "SRV\\Administrator"
|
|
"addsconfig.password" = var.adds_password
|
|
}
|
|
}
|
|
|
|
clone {
|
|
template_uuid = vsphere_content_library_item.Server2019.id
|
|
}
|
|
|
|
depends_on = [
|
|
vsphere_virtual_machine.TF-DC01
|
|
]
|
|
|
|
# # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
|
|
# lifecycle {
|
|
# prevent_destroy = true
|
|
# }
|
|
} |