This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
/
vsphere_virutal_machine_windows.tf
46 lines (38 loc) · 1.82 KB
/
vsphere_virutal_machine_windows.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
resource "vsphere_virtual_machine" "virtual_machine_windows" {
count = "${var.template_os_family == "windows" ? var.vm_count : 0}"
name = "${var.vm_name_prefix}${count.index}"
resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
datastore_id = "${data.vsphere_datastore.ds.id}"
num_cpus = "${var.num_cpus}"
memory = "${var.memory}"
guest_id = "${data.vsphere_virtual_machine.template.guest_id}"
wait_for_guest_net_timeout = "${var.wait_for_guest_net_timeout}"
network_interface {
network_id = "${data.vsphere_network.network.id}"
}
disk {
label = "disk0"
size = "${var.disk_size != "" ? var.disk_size : data.vsphere_virtual_machine.template.disks.0.size}"
thin_provisioned = "${var.linked_clone == "true" ? data.vsphere_virtual_machine.template.disks.0.thin_provisioned : true}"
eagerly_scrub = "${var.linked_clone == "true" ? data.vsphere_virtual_machine.template.disks.0.eagerly_scrub: false}"
}
clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"
linked_clone = "${var.linked_clone}"
customize {
windows_options {
computer_name = "${var.vm_name_prefix}${count.index}"
admin_password = "${var.admin_password}"
workgroup = "${var.workgroup}"
time_zone = "${var.time_zone != "" ? var.time_zone : "85"}"
}
network_interface {
ipv4_address = "${var.ipv4_network_address != "0.0.0.0/0" ? cidrhost(var.ipv4_network_address, var.ipv4_address_start + count.index) : ""}"
ipv4_netmask = "${var.ipv4_network_address != "0.0.0.0/0" ? element(split("/", var.ipv4_network_address), 1) : 0}"
dns_server_list = ["${var.dns_servers}"]
dns_domain = "${var.domain_name}"
}
ipv4_gateway = "${var.ipv4_gateway}"
}
}
}