From 7f11b21d46d459eb0d4a2ef83f0e40fa0c61dcc0 Mon Sep 17 00:00:00 2001 From: Karim Naufal Date: Sat, 5 Mar 2022 06:04:08 +0100 Subject: [PATCH] added a default subnet for the lb to use and not usurp node subnets --- main.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.tf b/main.tf index ce18aa8..ae01da9 100644 --- a/main.tf +++ b/main.tf @@ -13,12 +13,22 @@ resource "hcloud_network" "k3s" { ip_range = var.network_ipv4_range } +# This is the default subnet to be used by the load balancer. +resource "hcloud_network_subnet" "default" { + network_id = hcloud_network.k3s.id + type = "cloud" + network_zone = var.network_region + ip_range = "10.0.0.0/16" +} + resource "hcloud_network_subnet" "subnet" { for_each = var.network_ipv4_subnets network_id = hcloud_network.k3s.id type = "cloud" network_zone = var.network_region ip_range = each.value + + depends_on = [hcloud_network_subnet.default] } resource "hcloud_firewall" "k3s" {