-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.tf
71 lines (57 loc) · 2.19 KB
/
main.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -------------------------------------------------------
# FOLDER RESOURCES
# -------------------------------------------------------
data "vsphere_datacenter" "dc" {
name = "${var.vm_datacenter}"
}
resource "vsphere_folder" "test_folder" {
path = "test_folder"
type = "vm"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
# -------------------------------------------------------
# VIRTUAL MACHINE RESOURCES
# -------------------------------------------------------
# Terraform Customization will work if installed all dependencies, only on the supported OS list
# Dependencies: https://kb.vmware.com/s/article/2075048
# Supported OS list: https://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf
module "win-dhcp" {
source = "modules/windows_dhcp/"
vm_name = "test-win-dhcp"
vm_folder = "${vsphere_folder.test_folder.path}"
vm_template = "${var.vm_win_template}"
}
module "win-static" {
source = "modules/windows_static/"
vm_name = "test-win-static"
vm_folder = "${vsphere_folder.test_folder.path}"
vm_template = "${var.vm_win_template}"
vm_ip = "" # REQUIRED
}
module "linux-dhcp" {
source = "modules/linux_dhcp/"
vm_name = "test-linux-dhcp"
vm_folder = "${vsphere_folder.test_folder.path}"
vm_template = "${var.vm_linux_template}"
}
module "linux-static" {
source = "modules/linux_static/"
vm_name = "test-linux-static"
vm_folder = "${vsphere_folder.test_folder.path}"
vm_template = "${var.vm_linux_template}"
vm_ip = "" # REQUIRED
}
# Example of using a Customization script, if your VM does not have all the dependencies, or is not supported.
module "linux-dhcp-script" {
source = "modules/linux_dhcp_script/"
vm_name = "test-linux-dhcp-script"
vm_folder = "${vsphere_folder.test_folder.path}"
vm_template = "${var.vm_linux_template}"
}
module "linux-static-script" {
source = "modules/linux_static_script/"
vm_name = "test-linux-static-script"
vm_folder = "${vsphere_folder.test_folder.path}"
vm_template = "${var.vm_linux_template}"
vm_ip = "" # REQUIRED
}