Terraform.VirtualMachines/terraform/SRV01_ova.tf.disabled

73 lines
2.4 KiB
Plaintext
Raw Permalink Normal View History

2021-03-31 07:30:43 +00:00
data "vsphere_ovf_vm_template" "ovf-srv" {
2021-03-31 07:27:34 +00:00
name = "ovf-srv"
2021-02-02 12:06:52 +00:00
resource_pool_id = data.vsphere_resource_pool.pool.id
2021-03-31 07:50:24 +00:00
datastore_id = data.vsphere_datastore.datastore.id
2021-03-31 07:27:34 +00:00
host_system_id = data.vsphere_host.host.id
remote_ovf_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/Windows-Server-2019-LTSC.ova"
deployment_option = "standalone-small"
2021-04-05 08:35:22 +00:00
disk_provisioning = "thin"
2021-03-31 07:27:34 +00:00
}
resource "vsphere_virtual_machine" "vm-srv" {
name = "TF-SRV01"
num_cpus = var.vm_numcpu
memory = var.vm_memory
datacenter_id = data.vsphere_datacenter.dc.id
2021-03-31 07:50:24 +00:00
folder = var.hv_vmfolder
2021-02-02 12:06:52 +00:00
2021-03-31 07:27:34 +00:00
guest_id = data.vsphere_ovf_vm_template.ovf-srv.guest_id
resource_pool_id = data.vsphere_ovf_vm_template.ovf-srv.resource_pool_id
datastore_id = data.vsphere_ovf_vm_template.ovf-srv.datastore_id
host_system_id = data.vsphere_ovf_vm_template.ovf-srv.host_system_id
2021-02-02 12:06:52 +00:00
network_interface {
network_id = data.vsphere_network.network.id
}
2021-04-05 08:35:22 +00:00
wait_for_guest_net_timeout = 15
2021-02-02 12:06:52 +00:00
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
}
2021-03-31 07:27:34 +00:00
ovf_deploy {
remote_ovf_url = data.vsphere_ovf_vm_template.ovf-srv.remote_ovf_url
deployment_option = data.vsphere_ovf_vm_template.ovf-srv.deployment_option
}
2021-02-02 12:06:52 +00:00
vapp {
properties = {
"guestinfo.hostname" = "TF-SRV01"
"guestinfo.ipaddress" = "10.0.0.42"
"guestinfo.prefixlength" = "24"
"guestinfo.dnsserver" = "10.0.0.21"
"guestinfo.gateway" = "10.0.0.1"
"guestinfo.administratorpw" = var.adds_password
"guestinfo.ntpserver" = "0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org"
2021-03-31 07:27:34 +00:00
}
2021-02-02 12:06:52 +00:00
}
// "addsconfig.domainname" = var.adds_domainname
// "addsconfig.username" = var.adds_username
// "addsconfig.password" = var.adds_password
2021-02-02 12:06:52 +00:00
// depends_on = [
// vsphere_virtual_machine.vm-dc
// ]
2021-02-04 08:32:03 +00:00
// # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
// lifecycle {
// prevent_destroy = true
// }
2021-02-02 12:06:52 +00:00
}