From 8951d9cbb4d379364b0e579d4b6424902611b17e Mon Sep 17 00:00:00 2001 From: emily Date: Fri, 1 Mar 2019 23:32:03 +0000 Subject: [PATCH] Only set remove_default_node_pool for import if false - fixes TF tests Signed-off-by: Modular Magician --- google/resource_container_cluster.go | 7 ++----- website/docs/r/container_cluster.html.markdown | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/google/resource_container_cluster.go b/google/resource_container_cluster.go index 0fc5a371cc9..f373f57bce0 100644 --- a/google/resource_container_cluster.go +++ b/google/resource_container_cluster.go @@ -1813,11 +1813,8 @@ func resourceContainerClusterStateImporter(d *schema.ResourceData, meta interfac _, err := config.clientContainerBeta.Projects.Locations.Clusters.NodePools.Get(nodePool).Do() if err != nil && isGoogleApiErrorWithCode(err, 404) { d.Set("remove_default_node_pool", true) - } else { - d.Set("remove_default_node_pool", false) - if err != nil { - log.Printf("[WARN] Unable to import value for remove_default_node_pool, got error while trying to get default node pool: %s", err) - } + } else if err != nil { + log.Printf("[WARN] Unable to import value for remove_default_node_pool, got error while trying to get default node pool: %s", err) } return []*schema.ResourceData{d}, nil diff --git a/website/docs/r/container_cluster.html.markdown b/website/docs/r/container_cluster.html.markdown index 9c3233325c6..6d891285aa7 100644 --- a/website/docs/r/container_cluster.html.markdown +++ b/website/docs/r/container_cluster.html.markdown @@ -589,4 +589,4 @@ $ terraform import google_container_cluster.mycluster us-east1-a/my-cluster For example: - `min_master_version` will not be set on import and will show a no-op diff if set in config. -- `remove_default_node_pool`: If the default node pool exists at import, this value will be set to false in state (or true if non-existant). If set to true in config but the node pool exists, a follow-up diff/apply will delete the default node pool. +- `remove_default_node_pool`: If the default node pool does not exist at import, this value will be set to true in state, but it will not be set otherwise. Thus, you may see a no-op diff if set to false in config, or a diff if set to true in config when the default node pool still exists.