terraform-google-kubernetes-engine
terraform-google-kubernetes-engine copied to clipboard
google_container_node_pool create before destroy issue
TL;DR
When trying to change a machine type for a nodepool, using create_before_destroy to upgrade, getting error that the default nodepool already exists.
Expected behavior
Expect a new nodepool with the new machine type to be created (with a new name), old nodepool to be cordoned, drained, and deleted
Observed behavior
│ Error: resource - ***/default-node-pool-7d4f - already exists
│
│ with module.***.google_container_node_pool.pools["default-node-pool"],
Terraform Configuration
Only setting changed was machine-type
Terraform Version
Terraform v1.1.7
+ provider registry.terraform.io/hashicorp/google v3.90.1
+ provider registry.terraform.io/hashicorp/google-beta v3.90.1
Additional information
No response
Hi @dyu-bot Could you post a sample configuration so we can try to repro?
I have been looking into this as well.
I believe this is because we are setting name in the google_container_node_pool instead of name_prefix, and hence, since the node pool already exists, tf throws an error about it. I believe if we switch to using name_prefix instead of name, this should get sorted.
Using beta-private-cluster as an example
https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/master/modules/beta-private-cluster/cluster.tf#L421 <-- where name gets set instead of name_prefix
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days