1
0
IaC/terraform/hetzner/network.tf

122 lines
2.9 KiB
Terraform
Raw Normal View History

2024-04-16 11:36:58 -04:00
resource "hcloud_network" "us_east_lan" {
name = "us-east-lan"
ip_range = "10.128.1.0/24"
2024-04-16 10:56:53 -04:00
}
resource "hcloud_network_subnet" "lan" {
2024-04-16 11:36:58 -04:00
network_id = hcloud_network.us_east_lan.id
2024-04-16 10:56:53 -04:00
type = "cloud"
network_zone = "us-east"
ip_range = "10.128.1.0/24"
}
2024-04-16 11:36:58 -04:00
resource "hcloud_network" "us_east_sync" {
name = "us-east-sync"
ip_range = "10.128.2.0/24"
}
2024-04-16 10:56:53 -04:00
resource "hcloud_network_subnet" "sync" {
2024-04-16 11:36:58 -04:00
network_id = hcloud_network.us_east_sync.id
2024-04-16 10:56:53 -04:00
type = "cloud"
network_zone = "us-east"
ip_range = "10.128.2.0/24"
}
2024-04-16 11:36:58 -04:00
resource "hcloud_network" "us_east_cluster" {
name = "us-east-cluster"
ip_range = "10.128.3.0/24"
}
2024-04-16 10:56:53 -04:00
resource "hcloud_network_subnet" "cluster" {
2024-04-16 11:36:58 -04:00
network_id = hcloud_network.us_east_cluster.id
2024-04-16 10:56:53 -04:00
type = "cloud"
network_zone = "us-east"
ip_range = "10.128.3.0/24"
}
resource "hcloud_primary_ip" "opnsense_a_v4" {
name = "opnsense-a-v4"
type = "ipv4"
datacenter = "ash-dc1"
auto_delete = false
delete_protection = true
assignee_type = "server"
}
resource "hcloud_primary_ip" "opnsense_b_v4" {
name = "opnsense-b-v4"
type = "ipv4"
datacenter = "ash-dc1"
auto_delete = false
delete_protection = true
assignee_type = "server"
}
resource "hcloud_primary_ip" "opnsense_a_v6" {
name = "opnsense-a-v6"
type = "ipv6"
datacenter = "ash-dc1"
auto_delete = false
delete_protection = true
assignee_type = "server"
}
resource "hcloud_primary_ip" "opnsense_b_v6" {
name = "opnsense-b-v6"
type = "ipv6"
datacenter = "ash-dc1"
auto_delete = false
delete_protection = true
assignee_type = "server"
}
resource "hcloud_floating_ip" "opnsense_float_v4" {
name = "opnsense-float-v4"
type = "ipv4"
home_location = "ash"
delete_protection = true
}
resource "hcloud_floating_ip" "opnsense_float_v6" {
name = "opnsense-float-v6"
type = "ipv6"
home_location = "ash"
delete_protection = true
2024-04-16 11:36:58 -04:00
}
resource "hcloud_floating_ip_assignment" "opnsense-a-v4" {
floating_ip_id = hcloud_floating_ip.opnsense_float_v4.id
server_id = hcloud_server.opnsense_a.id
2024-04-16 12:06:14 -04:00
depends_on = [
hcloud_floating_ip.opnsense_float_v4,
hcloud_server.opnsense_a
]
2024-04-16 11:36:58 -04:00
}
resource "hcloud_floating_ip_assignment" "opnsense-a-v6" {
floating_ip_id = hcloud_floating_ip.opnsense_float_v6.id
server_id = hcloud_server.opnsense_a.id
2024-04-16 12:06:14 -04:00
depends_on = [
hcloud_floating_ip.opnsense_float_v6,
hcloud_server.opnsense_a
]
2024-04-16 11:36:58 -04:00
}
2024-04-16 12:06:14 -04:00
resource "hcloud_floating_ip_assignment" "opnsense-b-v4" {
floating_ip_id = hcloud_floating_ip.opnsense_float_v4.id
server_id = hcloud_server.opnsense_b.id
depends_on = [
hcloud_floating_ip.opnsense_float_v4,
hcloud_server.opnsense_b
]
}
2024-04-16 11:36:58 -04:00
2024-04-16 12:06:14 -04:00
resource "hcloud_floating_ip_assignment" "opnsense-b-v6" {
floating_ip_id = hcloud_floating_ip.opnsense_float_v6.id
server_id = hcloud_server.opnsense_b.id
depends_on = [
hcloud_floating_ip.opnsense_float_v6,
hcloud_server.opnsense_b
]
}