Skip to content

Commit 690efd5

Browse files
committed
fix panic
1 parent 590b9bb commit 690efd5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/services/containers/kubernetes_automatic_cluster_resource.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,9 @@ func (r KubernetesAutomaticClusterResource) Read() sdk.ResourceFunc {
24442444

24452445
state.LinuxProfile = flattenKubernetesAutomaticClusterLinuxProfile(props.LinuxProfile)
24462446
state.NetworkProfile = flattenKubernetesAutomaticClusterNetworkProfile(props.NetworkProfile)
2447+
24472448
state.WindowsProfile = flattenKubernetesAutomaticClusterWindowsProfile(props.WindowsProfile, metadata)
2449+
24482450
state.WorkloadAutoscalerProfile = flattenKubernetesAutomaticClusterWorkloadAutoscalerProfile(props.WorkloadAutoScalerProfile)
24492451
state.NodeProvisioningProfile = flattenKubernetesAutomaticClusterNodeProvisioningProfile(props.NodeProvisioningProfile)
24502452
state.HTTPProxyConfig = flattenKubernetesAutomaticClusterHttpProxyConfig(props.HTTPProxyConfig)
@@ -3304,7 +3306,10 @@ func flattenKubernetesAutomaticClusterWindowsProfile(profile *managedclusters.Ma
33043306

33053307
adminPassword := ""
33063308
if !rawConfig.IsNull() {
3307-
adminPassword = rawConfig.AsValueMap()["windows_profile"].AsValueSlice()[0].AsValueMap()["admin_password"].AsString()
3309+
windowsProfileSlice := rawConfig.AsValueMap()["windows_profile"].AsValueSlice()
3310+
if len(windowsProfileSlice) > 0 {
3311+
adminPassword = windowsProfileSlice[0].AsValueMap()["admin_password"].AsString()
3312+
}
33083313
}
33093314
license := ""
33103315
if profile.LicenseType != nil && pointer.From(profile.LicenseType) != managedclusters.LicenseTypeNone {

0 commit comments

Comments
 (0)