From 8639042999f468a6e79b872da3c88e527ddac9f6 Mon Sep 17 00:00:00 2001 From: Chris Stephens Date: Wed, 10 Jul 2019 13:38:26 -0700 Subject: [PATCH] Remove nodepool autoscaling when disabled (#2031) Merged PR #2031. --- .../resource_container_node_pool.go.erb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/third_party/terraform/resources/resource_container_node_pool.go.erb b/third_party/terraform/resources/resource_container_node_pool.go.erb index 8829b82ae07d..a80e82b4b022 100644 --- a/third_party/terraform/resources/resource_container_node_pool.go.erb +++ b/third_party/terraform/resources/resource_container_node_pool.go.erb @@ -547,12 +547,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{}{ - 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{}{} } }