1
0
IaC/terraform/hetzner/network.tf

106 lines
2.5 KiB
HCL

resource "hcloud_network" "us_east_lan" {
name = "us-east-lan"
ip_range = "10.128.1.0/24"
}
resource "hcloud_network_subnet" "lan" {
network_id = hcloud_network.us_east_lan.id
type = "cloud"
network_zone = "us-east"
ip_range = "10.128.1.0/24"
}
resource "hcloud_network" "us_east_sync" {
name = "us-east-sync"
ip_range = "10.128.2.0/24"
}
resource "hcloud_network_subnet" "sync" {
network_id = hcloud_network.us_east_sync.id
type = "cloud"
network_zone = "us-east"
ip_range = "10.128.2.0/24"
}
resource "hcloud_network" "us_east_cluster" {
name = "us-east-cluster"
ip_range = "10.128.3.0/24"
}
resource "hcloud_network_subnet" "cluster" {
network_id = hcloud_network.us_east_cluster.id
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
}
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
}
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
}
# 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
# }
# 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
# }