From 650461f3bafe256cdebe4cbe341d0f5229870af5 Mon Sep 17 00:00:00 2001 From: Marcel Richter Date: Tue, 25 Nov 2025 22:15:22 +0100 Subject: [PATCH] fix(network): skip worker IPv6 allocation when no workers exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, when creating a cluster with only control plane nodes (worker_count = 0), Terraform would still allocate 1 unused worker IPv6 primary IP. This caused "Primary IP limit exceeded" errors and wasted resources. Changes: - Worker IPv6: Use total_worker_count directly (no fallback to 1) - Worker private IPs: Remove unnecessary fallback for consistency - Aligns worker IPv6 behavior with worker IPv4 allocation Fixes #284 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- network.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/network.tf b/network.tf index 0950758..894b68f 100644 --- a/network.tf +++ b/network.tf @@ -97,7 +97,7 @@ resource "hcloud_primary_ip" "worker_ipv4" { } resource "hcloud_primary_ip" "worker_ipv6" { - count = var.enable_ipv6 ? local.total_worker_count > 0 ? local.total_worker_count : 1 : 0 + count = var.enable_ipv6 ? local.total_worker_count : 0 name = "${local.cluster_prefix}worker-${count.index + 1}-ipv6" datacenter = data.hcloud_datacenter.this.name type = "ipv6" @@ -139,6 +139,6 @@ locals { for index in range(var.control_plane_count > 0 ? var.control_plane_count : 1) : cidrhost(hcloud_network_subnet.nodes.ip_range, index + 101) ] worker_private_ipv4_list = [ - for index in range(local.total_worker_count > 0 ? local.total_worker_count : 1) : cidrhost(hcloud_network_subnet.nodes.ip_range, index + 201) + for index in range(local.total_worker_count) : cidrhost(hcloud_network_subnet.nodes.ip_range, index + 201) ] }