hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.32k stars 1.72k forks source link

resource_container_node_pool Change initial_node_count -> ForceNew to false #9570

Closed r4hulgupta closed 2 years ago

r4hulgupta commented 3 years ago

Community Note

Description

Changing the value of initial_node_count forces a node pool destroy and create. In general when doing such an operation using gcloud container clusters resize <CLUSTER_NAME> --num-nodes <> --node-pool <> does not really destroy and create the node pool.

The current resource implementation has ForceNew set to true and it maybe as simple as setting it to false?

I can assume there was some history behind the current implementation but I would like to propose this change and understand why if it can't be done.

The reason behind changing initial_node_count to scale up and down a node-pool manually is so that users can adjust their node pool minimum size which only changes during a scale up event by the autoscaler even if the current node pool size is <= min_node_count. So if a user wants their min_node_count to be increased it won't trigger a scale up until autoscaler sees the need to scale up, and in that case changing initial_node_count could help get to the desired number of nodes without destroying and creating the node pool.

New or Affected Resource(s)

resource_container_cluster_node_pool resource_container_cluster

Potential Terraform Configuration

Proposed changes do not make changes to terraform configuration. It could be simply changing ForceNew to False.

References

rileykarson commented 2 years ago

With the field named initial_node_count as is, changing the count up/down would imply the cluster was provisioned w/ a different initial count. I don't believe that's a change we want to make. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#node_count is the field to manually update the # of nodes in a pool.

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.