-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
39 lines (34 loc) · 949 Bytes
/
main.tf
File metadata and controls
39 lines (34 loc) · 949 Bytes
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
#main tf build
variable "vms" {
type = list(object({
name = string
num_cpus = number
memory = number
disk_size = number
datastore = string
network = string
guest_id = string
iso_path = string
}))
}
resource "vsphere_virtual_machine" "vm" {
for_each = { for idx, vm in var.vms : idx => vm }
name = each.value.name
resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.ds[each.value.datastore].id
num_cpus = each.value.num_cpus
memory = each.value.memory
guest_id = each.value.guest_id
network_interface {
network_id = data.vsphere_network.net[each.value.network].id
}
disk {
label = "disk0"
size = each.value.disk_size
}
cdrom {
client_device = true
datastore_id = data.vsphere_datastore.ds[each.value.datastore].id
path = each.value.iso_path
}
}