Skip to content

Commit 3c33631

Browse files
committed
feat: Supporting no static outbound ips as well
1 parent c499f8b commit 3c33631

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

main.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ resource "azurerm_kubernetes_cluster" "k8s" {
4848
network_plugin = "azure"
4949
network_policy = var.network_policy
5050
load_balancer_sku = length(var.node_pools) > 0 ? "Standard" : var.load_balancer_sku
51-
load_balancer_profile {
52-
outbound_ip_address_ids = azurerm_public_ip.public-ip-outbound[*].id
53-
outbound_ports_allocated = var.outbound_ports_allocated
54-
idle_timeout_in_minutes = var.idle_timeout
51+
dynamic load_balancer_profile {
52+
for_each = azurerm_public_ip.public-ip-outbound
53+
content {
54+
outbound_ip_address_ids = azurerm_public_ip.public-ip-outbound[*].id
55+
outbound_ports_allocated = var.outbound_ports_allocated
56+
idle_timeout_in_minutes = var.idle_timeout
57+
}
5558
}
5659
}
5760

@@ -88,4 +91,4 @@ resource "azurerm_public_ip" "public-ip-outbound" {
8891
location = var.location
8992
resource_group_name = var.resource_group
9093
sku = "Standard"
91-
}
94+
}

vars.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ variable "static_outbound_ip_count" {
129129
bottlenecks. Recommended in that case is to set the count at least +5 more than the count of kubernetes nodes.
130130
EOF
131131
validation {
132-
condition = var.static_outbound_ip_count >= 1 && var.static_outbound_ip_count <= 100
133-
error_message = "Static_outbound_ip_count has to be between 1 and 100 including."
132+
condition = var.static_outbound_ip_count >= 0 && var.static_outbound_ip_count <= 100
133+
error_message = "Static_outbound_ip_count has to be between 0 and 100 including."
134134
}
135-
default = 1
135+
default = 0
136136
}
137137

138138
variable "outbound_ports_allocated" {

0 commit comments

Comments
 (0)