Terraform.VirtualMachines/terraform/main.tf
djpbessems 84832dd3a6
Some checks failed
continuous-integration/drone/push Build is failing
Rebase to vSphere template
2022-03-03 13:37:36 +01:00

48 lines
1.2 KiB
HCL

terraform {
backend "pg" {}
required_providers {
vsphere = {
source = "hashicorp/vsphere"
version = "2.1.0"
}
}
}
provider "vsphere" {
vsphere_server = var.hv_fqdn
user = var.hv_username
password = var.hv_password
allow_unverified_ssl = true
}
data "vsphere_datacenter" "dc" {
name = var.hv_datacenter
}
data "vsphere_resource_pool" "pool" {
name = var.hv_resourcepool
// name = "/${var.hv_datacenter}/host/${var.hv_host}/Resources"
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_host" "host" {
name = var.hv_host
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_datastore" "datastore" {
name = var.hv_datastore
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_network" "network" {
name = var.hv_network
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_virtual_machine" "template" {
name = var.vm_template
datacenter_id = data.vsphere_datacenter.dc.id
}