mirror of
https://github.com/outbackdingo/terraform-hcloud-talos.git
synced 2026-01-27 10:20:30 +00:00
fix(network): skip worker IPv6 allocation when no workers exist
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user