-
Notifications
You must be signed in to change notification settings - Fork 0
/
04-esx-hosts.tf
39 lines (35 loc) · 1.42 KB
/
04-esx-hosts.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
resource "packet_device" "esxi_hosts" {
depends_on = [packet_project_ssh_key.ssh_pub_key]
count = var.esxi_host_count
hostname = format("%s%02d", var.esxi_hostname, count.index + 1)
plan = var.esxi_size
facilities = [var.facility]
operating_system = var.vmware_os
billing_cycle = var.billing_cycle
project_id = local.project_id
network_type = "hybrid"
tags = ["vmware", "hypervisor", "anthos"]
ip_address {
type = "public_ipv4"
cidr = 29
reservation_ids = [element(packet_reserved_ip_block.esx_ip_blocks.*.id, count.index)]
}
ip_address {
type = "private_ipv4"
}
ip_address {
type = "public_ipv6"
}
}
resource "packet_port_vlan_attachment" "esxi_priv_vlan_attach" {
count = length(packet_device.esxi_hosts) * length(packet_vlan.private_vlans)
device_id = element(packet_device.esxi_hosts.*.id, ceil(count.index / length(packet_vlan.private_vlans)))
port_name = "eth1"
vlan_vnid = jsonencode(element(packet_vlan.private_vlans.*.vxlan, count.index))
}
resource "packet_port_vlan_attachment" "esxi_pub_vlan_attach" {
count = length(packet_device.esxi_hosts) * length(packet_vlan.public_vlans)
device_id = element(packet_device.esxi_hosts.*.id, ceil(count.index / length(packet_vlan.public_vlans)))
port_name = "eth1"
vlan_vnid = element(packet_vlan.public_vlans.*.vxlan, count.index)
}