Terraform.VirtualMachines/terraform/main.tf

42 lines
995 B
Terraform
Raw Normal View History

2021-02-02 12:06:52 +00:00
terraform {
backend "pg" {}
2021-02-02 12:30:06 +00:00
required_providers {
vsphere = {
source = "hashicorp/vsphere"
2021-03-31 07:27:34 +00:00
version = "~> 1.25.0"
2021-02-02 12:30:06 +00:00
}
}
2021-02-02 12:06:52 +00:00
}
provider "vsphere" {
2021-03-31 07:27:34 +00:00
vsphere_server = var.hv_fqdn
user = var.hv_username
password = var.hv_password
2021-02-02 12:06:52 +00:00
allow_unverified_ssl = true
}
data "vsphere_datacenter" "dc" {
2021-03-31 07:27:34 +00:00
name = var.hv_datacenter
2021-02-02 12:06:52 +00:00
}
data "vsphere_resource_pool" "pool" {
2021-03-31 07:27:34 +00:00
name = "/${var.hv_datacenter}/host/${var.hv_host}/Resources"
2021-02-02 12:06:52 +00:00
datacenter_id = data.vsphere_datacenter.dc.id
}
2021-03-31 07:27:34 +00:00
data "vsphere_host" "host" {
name = var.hv_host
datacenter = data.vsphere_datacenter.dc.id
2021-02-02 12:06:52 +00:00
}
2021-03-31 07:27:34 +00:00
data "vsphere_datastore" "datastore" {
name = var.hv_datastore
2021-02-02 12:06:52 +00:00
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_network" "network" {
2021-03-31 07:27:34 +00:00
name = var.hv_network
2021-02-02 12:06:52 +00:00
datacenter_id = data.vsphere_datacenter.dc.id
}