@@ -5,6 +5,12 @@ locals {
55 var. control_plane_public_vip_ipv4_enabled
66 )
77 )
8+ control_plane_public_vip_ipv6_enabled = (
9+ local. network_public_ipv6_enabled && (
10+ var. control_plane_public_vip_ipv6_id != null ||
11+ var. control_plane_public_vip_ipv6_enabled
12+ )
13+ )
814}
915
1016resource "hcloud_floating_ip" "control_plane_ipv4" {
@@ -13,7 +19,22 @@ resource "hcloud_floating_ip" "control_plane_ipv4" {
1319 name = " ${ var . cluster_name } -control-plane-ipv4"
1420 type = " ipv4"
1521 home_location = hcloud_server. control_plane [local . talos_primary_node_name ]. location
16- description = " Control Plane Public VIP"
22+ description = " Control Plane Public VIPv4"
23+ delete_protection = var. cluster_delete_protection
24+
25+ labels = {
26+ cluster = var.cluster_name,
27+ role = " control-plane"
28+ }
29+ }
30+
31+ resource "hcloud_floating_ip" "control_plane_ipv6" {
32+ count = local. control_plane_public_vip_ipv6_enabled && var. control_plane_public_vip_ipv6_id == null ? 1 : 0
33+
34+ name = " ${ var . cluster_name } -control-plane-ipv6"
35+ type = " ipv6"
36+ home_location = hcloud_server. control_plane [local . talos_primary_node_name ]. location
37+ description = " Control Plane Public VIPv6"
1738 delete_protection = var. cluster_delete_protection
1839
1940 labels = {
@@ -30,3 +51,12 @@ data "hcloud_floating_ip" "control_plane_ipv4" {
3051 local. control_plane_public_vip_ipv4_enabled ? try (hcloud_floating_ip. control_plane_ipv4 [0 ]. id , null ) : null
3152 )
3253}
54+
55+ data "hcloud_floating_ip" "control_plane_ipv6" {
56+ count = local. control_plane_public_vip_ipv6_enabled ? 1 : 0
57+
58+ id = coalesce (
59+ can (var. control_plane_public_vip_ipv6_id ) ? var. control_plane_public_vip_ipv6_id : null ,
60+ local. control_plane_public_vip_ipv6_enabled ? try (hcloud_floating_ip. control_plane_ipv6 [0 ]. id , null ) : null
61+ )
62+ }
0 commit comments