57 lines
2.0 KiB
Terraform
57 lines
2.0 KiB
Terraform
|
resource "vsphere_virtual_machine" "TF-Windows2019" {
|
||
|
name = "TF-Windows2019"
|
||
|
resource_pool_id = data.vsphere_resource_pool.pool.id
|
||
|
datastore_id = data.vsphere_datastore.datastore.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 = 150
|
||
|
thin_provisioned = true
|
||
|
}
|
||
|
disk {
|
||
|
label = "disk1"
|
||
|
unit_number = 1
|
||
|
size = 225
|
||
|
thin_provisioned = true
|
||
|
}
|
||
|
|
||
|
vapp {
|
||
|
properties = {
|
||
|
"guestinfo.hostname" = "<<vm-hostname>>"
|
||
|
"guestinfo.ipaddress" = "<<vm-ipaddress>>"
|
||
|
"guestinfo.netmask" = "<<vm-netmask>>"
|
||
|
"guestinfo.gateway" = "<<vm-gateway>>"
|
||
|
"guestinfo.dns" = "<<vm-dns>>"
|
||
|
"guestinfo.domain_name" = "<<vm-searchdomain>>"
|
||
|
"guestinfo.ntp" = "<<vm-ntp>>"
|
||
|
"guestinfo.enable_domain_join" = "<<ad-enable-domain-join>>"
|
||
|
"guestinfo.domain_short_name" = "<<ad-netbios>>"
|
||
|
"guestinfo.domain_join_user" = "<<ad-user>>"
|
||
|
"guestinfo.domain_join_password" = "<<ad-password>>"
|
||
|
"guestinfo.domain_controller" = "<<ad-domaincontroller>>"
|
||
|
"guestinfo.viadmin_password" = "<<pass-viadmin>>"
|
||
|
"guestinfo.viuser_password" = "<<pass-viuser>>"
|
||
|
"guestinfo.viservice_password" = "<<pass-viservice>>"
|
||
|
"guestinfo.project_name" = "<<proj-name>>"
|
||
|
"guestinfo.monitor_server" = "<<mon-address>>"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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
|
||
|
# }
|
||
|
}
|