@@ -558,17 +558,18 @@ func testAccCheckContainerCluster(n string) resource.TestCheckFunc {
558
558
}
559
559
clusterTests = append (clusterTests , clusterTestField {"additional_zones" , additionalZones })
560
560
561
- // AddonsConfig is neither Required or Computed, so the API may return nil for it
562
- if cluster .AddonsConfig != nil {
563
- if cluster .AddonsConfig .HttpLoadBalancing != nil {
564
- clusterTests = append (clusterTests , clusterTestField {"addons_config.0.http_load_balancing.0.disabled" , strconv .FormatBool (cluster .AddonsConfig .HttpLoadBalancing .Disabled )})
565
- }
566
- if cluster .AddonsConfig .HorizontalPodAutoscaling != nil {
567
- clusterTests = append (clusterTests , clusterTestField {"addons_config.0.horizontal_pod_autoscaling.0.disabled" , strconv .FormatBool (cluster .AddonsConfig .HorizontalPodAutoscaling .Disabled )})
568
- }
569
- if cluster .AddonsConfig .KubernetesDashboard != nil {
570
- clusterTests = append (clusterTests , clusterTestField {"addons_config.0.KubernetesDashboard.0.disabled" , strconv .FormatBool (cluster .AddonsConfig .KubernetesDashboard .Disabled )})
571
- }
561
+ // AddonsConfig is neither Required or Computed, so the API may return nil for it.
562
+ httpLoadBalancingDisabled := false
563
+ if cluster .AddonsConfig != nil && cluster .AddonsConfig .HttpLoadBalancing != nil {
564
+ httpLoadBalancingDisabled = cluster .AddonsConfig .HttpLoadBalancing .Disabled
565
+ }
566
+ horizontalPodAutoscalingDisabled := false
567
+ if cluster .AddonsConfig != nil && cluster .AddonsConfig .HorizontalPodAutoscaling != nil {
568
+ horizontalPodAutoscalingDisabled = cluster .AddonsConfig .HorizontalPodAutoscaling .Disabled
569
+ }
570
+ kubernetesDashboardDisabled := false
571
+ if cluster .AddonsConfig != nil && cluster .AddonsConfig .KubernetesDashboard != nil {
572
+ kubernetesDashboardDisabled = cluster .AddonsConfig .KubernetesDashboard .Disabled
572
573
}
573
574
clusterTests = append (clusterTests , clusterTestField {"addons_config.0.http_load_balancing.0.disabled" , httpLoadBalancingDisabled })
574
575
clusterTests = append (clusterTests , clusterTestField {"addons_config.0.horizontal_pod_autoscaling.0.disabled" , horizontalPodAutoscalingDisabled })
0 commit comments