forked from ewypych/terraform-vsphere-single-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstance.tf
25 lines (23 loc) · 915 Bytes
/
instance.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
resource "vsphere_virtual_machine" "TEST-VM" {
name = "${var.vmname}"
hostname = "${var.vmhostname}"
vcpu = 2
memory = 4096
domain = "${var.vmdomain}"
dns_suffixes = [ "${var.vmdomain}" ]
datacenter = "YOUR_DC"
cluster = "${lookup(var.vmcluster,var.vmrp)}"
resource_pool = "${lookup(var.vmcluster, var.vmrp)}/Resources/${var.vmrp}"
dns_servers = ["${lookup(var.vmdns1,var.vmdomain)}", "${lookup(var.vmdns2,var.vmdomain)}"]
network_interface {
label = "${lookup(var.vmnetlabel, var.vmdomain)}"
ipv4_address = "${lookup(var.vmaddrbase,var.vmdomain)}${var.vmaddroctet}"
ipv4_gateway = "${lookup(var.vmgateway,var.vmdomain)}"
ipv4_prefix_length = "24"
}
disk {
template = "Linux_templates/${var.vmtemp}"
type = "thin"
datastore = "${lookup(var.vmdscluster, var.vmdatastore)}/${var.vmdatastore}"
}
}