From 80834601a95db4da6d6d3a30d95d37ea6bcf8852 Mon Sep 17 00:00:00 2001 From: stephybun Date: Fri, 28 Oct 2022 18:08:56 +0200 Subject: [PATCH] `azurerm_kubernetes_cluster` - nil check `publicNetworkAccess` (#19048) * nil check publicNetworkAccess * assign correct value to variable --- .../services/containers/kubernetes_cluster_resource.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/services/containers/kubernetes_cluster_resource.go b/internal/services/containers/kubernetes_cluster_resource.go index 306aa48678ad..cb603d72fb50 100644 --- a/internal/services/containers/kubernetes_cluster_resource.go +++ b/internal/services/containers/kubernetes_cluster_resource.go @@ -1882,7 +1882,12 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("node_resource_group", props.NodeResourceGroup) d.Set("enable_pod_security_policy", props.EnablePodSecurityPolicy) d.Set("local_account_disabled", props.DisableLocalAccounts) - d.Set("public_network_access_enabled", *props.PublicNetworkAccess != managedclusters.PublicNetworkAccessDisabled) + + publicNetworkAccess := managedclusters.PublicNetworkAccessEnabled + if props.PublicNetworkAccess != nil { + publicNetworkAccess = *props.PublicNetworkAccess + } + d.Set("public_network_access_enabled", publicNetworkAccess != managedclusters.PublicNetworkAccessDisabled) upgradeChannel := "" if profile := props.AutoUpgradeProfile; profile != nil && *profile.UpgradeChannel != managedclusters.UpgradeChannelNone {