2021-03-31 07:30:43 +00:00
|
|
|
data "vsphere_ovf_vm_template" "ovf-dc" {
|
2021-03-31 07:27:34 +00:00
|
|
|
name = "ovf-dc"
|
2021-02-04 08:32:03 +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/ADDS-appliance.ova"
|
|
|
|
deployment_option = "standalone"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "vsphere_virtual_machine" "vm-dc" {
|
|
|
|
name = "TF-DC01"
|
|
|
|
|
|
|
|
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-04 08:32:03 +00:00
|
|
|
|
2021-03-31 07:27:34 +00:00
|
|
|
guest_id = data.vsphere_ovf_vm_template.ovf-dc.guest_id
|
|
|
|
resource_pool_id = data.vsphere_ovf_vm_template.ovf-dc.resource_pool_id
|
|
|
|
datastore_id = data.vsphere_ovf_vm_template.ovf-dc.datastore_id
|
|
|
|
host_system_id = data.vsphere_ovf_vm_template.ovf-dc.host_system_id
|
2021-02-04 08:32:03 +00:00
|
|
|
|
|
|
|
network_interface {
|
|
|
|
network_id = data.vsphere_network.network.id
|
|
|
|
}
|
|
|
|
|
|
|
|
disk {
|
|
|
|
label = "disk0"
|
|
|
|
unit_number = 0
|
|
|
|
size = 40
|
|
|
|
thin_provisioned = true
|
|
|
|
}
|
|
|
|
|
2021-03-31 07:27:34 +00:00
|
|
|
ovf_deploy {
|
|
|
|
remote_ovf_url = data.vsphere_ovf_vm_template.ovf-dc.remote_ovf_url
|
|
|
|
deployment_option = data.vsphere_ovf_vm_template.ovf-dc.deployment_option
|
|
|
|
}
|
|
|
|
|
2021-02-04 08:32:03 +00:00
|
|
|
vapp {
|
|
|
|
properties = {
|
|
|
|
"guestinfo.hostname" = "TF-DC01"
|
|
|
|
"guestinfo.ipaddress" = "10.0.0.21"
|
|
|
|
"guestinfo.prefixlength" = "24"
|
|
|
|
"guestinfo.gateway" = "10.0.0.1"
|
|
|
|
|
2021-03-31 07:27:34 +00:00
|
|
|
"addsconfig.domainname" = var.adds_domainname
|
|
|
|
"addsconfig.netbiosname" = var.adds_netbiosname
|
2021-02-04 08:32:03 +00:00
|
|
|
"addsconfig.administratorpw" = var.adds_password
|
|
|
|
"addsconfig.safemodepw" = var.adds_password
|
2021-03-31 07:27:34 +00:00
|
|
|
"addsconfig.ntpserver" = var.adds_ntpserver
|
2021-02-04 08:32:03 +00:00
|
|
|
|
2021-03-31 07:27:34 +00:00
|
|
|
"dhcpconfig.startip" = var.dhcp_startip
|
|
|
|
"dhcpconfig.endip" = var.dhcp_endip
|
|
|
|
"dhcpconfig.subnetmask" = var.dhcp_subnetmask
|
|
|
|
"dhcpconfig.gateway" = var.dhcp_gateway
|
|
|
|
"dhcpconfig.leaseduration" = var.dhcp_leaseduration
|
2021-03-31 07:59:33 +00:00
|
|
|
|
|
|
|
"vault.api" = var.vault_api
|
|
|
|
"vault.token" = var.vault_token
|
|
|
|
"vault.pwpolicy" = var.vault_pwpolicy
|
|
|
|
"vault.secret" = var.vault_secret
|
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
|
|
|
|
# }
|
|
|
|
}
|