From 203092cda4099c25b3a33597acd45af02ca1b3fc Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Wed, 10 Jul 2019 00:29:34 +0000 Subject: [PATCH] Remove nodepool autoscaling when disabled Signed-off-by: Modular Magician --- google/resource_container_node_pool.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/google/resource_container_node_pool.go b/google/resource_container_node_pool.go index 0f4bdb44ea6..a542a01c6fe 100644 --- a/google/resource_container_node_pool.go +++ b/google/resource_container_node_pool.go @@ -537,12 +537,16 @@ func flattenNodePool(d *schema.ResourceData, config *Config, np *containerBeta.N "version": np.Version, } - if np.Autoscaling != nil && np.Autoscaling.Enabled { - nodePool["autoscaling"] = []map[string]interface{}{ - { - "min_node_count": np.Autoscaling.MinNodeCount, - "max_node_count": np.Autoscaling.MaxNodeCount, - }, + if np.Autoscaling != nil { + if np.Autoscaling.Enabled { + nodePool["autoscaling"] = []map[string]interface{}{ + { + "min_node_count": np.Autoscaling.MinNodeCount, + "max_node_count": np.Autoscaling.MaxNodeCount, + }, + } + } else { + nodePool["autoscaling"] = []map[string]interface{}{} } }