From cbedf84ab434b4c0d78dbe0173f8c8bbc7dc3376 Mon Sep 17 00:00:00 2001 From: Fraser Davidson Date: Tue, 9 Jan 2024 15:09:38 +0000 Subject: [PATCH] Bug fix for Kubernetes Cluster API server access profile (#47) --- modules/kubernetes-cluster/src/main.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/kubernetes-cluster/src/main.tf b/modules/kubernetes-cluster/src/main.tf index f60eb40..2bdedb1 100644 --- a/modules/kubernetes-cluster/src/main.tf +++ b/modules/kubernetes-cluster/src/main.tf @@ -34,8 +34,12 @@ resource "azurerm_kubernetes_cluster" "main" { tags = merge(var.tags, local.tags) } - api_server_access_profile { - authorized_ip_ranges = var.authorized_ip_ranges + dynamic "api_server_access_profile" { + for_each = length(var.authorized_ip_ranges) > 0 ? [{}] : [] + + content { + authorized_ip_ranges = api_server_access_profile.value.authorized_ip_ranges + } } identity {