Skip to content

Commit

Permalink
only set remove_default_node_pool for import if false
Browse files Browse the repository at this point in the history
  • Loading branch information
emilymye committed Mar 1, 2019
1 parent e80a97b commit 14dc015
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2170,11 +2170,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 14dc015

Please sign in to comment.