diff --git a/google-beta/resource_container_cluster.go b/google-beta/resource_container_cluster.go index 290a603ba8..ed7f24893e 100644 --- a/google-beta/resource_container_cluster.go +++ b/google-beta/resource_container_cluster.go @@ -2721,9 +2721,12 @@ func flattenMasterAuth(ma *containerBeta.MasterAuth) []map[string]interface{} { func flattenClusterAutoscaling(a *containerBeta.ClusterAutoscaling) []map[string]interface{} { r := make(map[string]interface{}) - if a == nil || !a.EnableNodeAutoprovisioning { + if a == nil { r["enabled"] = false - } else { + return []map[string]interface{}{r} + } + + if a.EnableNodeAutoprovisioning { resourceLimits := make([]interface{}, 0, len(a.ResourceLimits)) for _, rl := range a.ResourceLimits { resourceLimits = append(resourceLimits, map[string]interface{}{ @@ -2735,6 +2738,8 @@ func flattenClusterAutoscaling(a *containerBeta.ClusterAutoscaling) []map[string r["resource_limits"] = resourceLimits r["enabled"] = true r["auto_provisioning_defaults"] = flattenAutoProvisioningDefaults(a.AutoprovisioningNodePoolDefaults) + } else { + r["enabled"] = false } r["autoscaling_profile"] = a.AutoscalingProfile