2021-02-02 13:03:16 +00:00
|
|
|
resource "vsphere_virtual_machine" "TF-SRV01" {
|
|
|
|
name = "TF-SRV01"
|
2021-02-02 12:06:52 +00:00
|
|
|
resource_pool_id = data.vsphere_resource_pool.pool.id
|
2021-02-02 12:34:30 +00:00
|
|
|
datastore_id = data.vsphere_datastore.vmdatastore.id
|
2021-02-02 12:06:52 +00:00
|
|
|
folder = var.vsphere_vmfolder
|
|
|
|
|
|
|
|
num_cpus = 2
|
|
|
|
memory = 4096
|
|
|
|
|
|
|
|
network_interface {
|
|
|
|
network_id = data.vsphere_network.network.id
|
|
|
|
}
|
|
|
|
|
|
|
|
disk {
|
|
|
|
label = "disk0"
|
|
|
|
unit_number = 0
|
2021-02-02 13:03:16 +00:00
|
|
|
size = 40
|
2021-02-02 12:06:52 +00:00
|
|
|
thin_provisioned = true
|
|
|
|
}
|
|
|
|
disk {
|
|
|
|
label = "disk1"
|
|
|
|
unit_number = 1
|
2021-02-02 13:03:16 +00:00
|
|
|
size = 25
|
2021-02-02 12:06:52 +00:00
|
|
|
thin_provisioned = true
|
|
|
|
}
|
|
|
|
|
|
|
|
vapp {
|
|
|
|
properties = {
|
2021-02-04 07:43:28 +00:00
|
|
|
# "deployment.type" = "standalone"
|
2021-02-03 13:20:39 +00:00
|
|
|
|
|
|
|
"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.5"
|
|
|
|
"guestinfo.gateway" = "10.0.0.1"
|
|
|
|
|
|
|
|
"addsconfig.domainname" = ""
|
|
|
|
"addsconfig.username" = ""
|
|
|
|
"addsconfig.password" = ""
|
2021-02-02 12:06:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
# }
|
|
|
|
}
|