1
0
IaC/terraform/hetzner/servers.tf
2024-04-17 04:06:14 +12:00

71 lines
1.6 KiB
HCL

resource "hcloud_placement_group" "firewalls" {
name = "firewalls"
type = "spread"
}
resource "hcloud_placement_group" "nodes" {
name = "nodes"
type = "spread"
}
resource "hcloud_server" "opnsense_a" {
name = "opnsense-a"
server_type = "cpx11"
image = "ubuntu-22.04"
datacenter = "ash-dc1"
keep_disk = true
backups = false
public_net {
ipv4_enabled = true
ipv4 = hcloud_primary_ip.opnsense_a_v4.id
ipv6_enabled = true
ipv6 = hcloud_primary_ip.opnsense_a_v6.id
}
network {
network_id = hcloud_network.us_east_lan.id
ip = "10.128.1.250"
}
network {
network_id = hcloud_network.us_east_sync.id
ip = "10.128.2.10"
}
depends_on = [
hcloud_network_subnet.lan,
hcloud_network_subnet.sync
]
delete_protection = true
rebuild_protection = true
placement_group_id = hcloud_placement_group.firewalls.id
}
resource "hcloud_server" "opnsense_b" {
name = "opnsense-b"
server_type = "cpx11"
image = "ubuntu-22.04"
# iso = "OPNsense-23.7-dvd-amd64.iso"
datacenter = "ash-dc1"
keep_disk = true
backups = false
public_net {
ipv4_enabled = true
ipv4 = hcloud_primary_ip.opnsense_b_v4.id
ipv6_enabled = true
ipv6 = hcloud_primary_ip.opnsense_b_v6.id
}
network {
network_id = hcloud_network.us_east_lan.id
ip = "10.128.1.240"
}
network {
network_id = hcloud_network.us_east_sync.id
ip = "10.128.2.20"
}
depends_on = [
hcloud_network_subnet.lan,
hcloud_network_subnet.sync
]
delete_protection = true
rebuild_protection = true
placement_group_id = hcloud_placement_group.firewalls.id
}