Terraform.VirtualMachines/terraform/SRV01.tf

57 lines
1.6 KiB
Terraform
Raw Normal View History

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"
"guestinfo.hostname" = "TF-SRV01"
2021-02-04 08:32:03 +00:00
# "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"
2021-02-04 08:32:03 +00:00
"guestinfo.dnsserver" = "10.0.0.21"
"guestinfo.gateway" = "10.0.0.1"
2021-02-04 08:32:03 +00:00
"addsconfig.domainname" = "srv.io"
"addsconfig.username" = "SRV\\Administrator"
"addsconfig.password" = var.adds_password
2021-02-02 12:06:52 +00:00
}
}
clone {
template_uuid = vsphere_content_library_item.Server2019.id
}
2021-02-04 08:32:03 +00:00
depends_on = [
vsphere_virtual_machine.TF-DC01
]
2021-02-02 12:06:52 +00:00
# # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
# lifecycle {
# prevent_destroy = true
# }
}