Skip to content

Commit

Permalink
Only set remove_default_node_pool for import if false - fixes TF tests
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
emilymye authored and modular-magician committed Mar 1, 2019
1 parent 984fa73 commit 8fb4af4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
7 changes: 2 additions & 5 deletions google-beta/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2062,11 +2062,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
8 changes: 1 addition & 7 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,6 @@ The `ip_allocation_policy` block supports:
from the RFC-1918 private networks (e.g. 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) to
pick a specific range to use.

* `node_ipv4_cidr_block` - (Optional) The IP address range of the node IPs in this cluster.
Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14)
to have a range chosen with a specific netmask. Set to a CIDR notation (e.g. 10.96.0.0/14)
from the RFC-1918 private networks (e.g. 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) to
pick a specific range to use.

* `services_ipv4_cidr_block` - (Optional) The IP address range of the services IPs in this cluster.
Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14)
to have a range chosen with a specific netmask. Set to a CIDR notation (e.g. 10.96.0.0/14)
Expand Down Expand Up @@ -589,4 +583,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 8fb4af4

Please sign in to comment.