Terraform is replacing the GKE instance_groups instead of refreshing the resource

we are using this module - terraform-google-kubernetes-engine/cluster.tf at master · terraform-google-modules/terraform-google-kubernetes-engine · GitHub

ever-time when we terraform apply, instead of refreshing the existing the resource it is detecting a change in instance_groups_urls & managed_instance_group_urls and recreating the GKE nodes, where as there are no changes made outside of Terraform.

How can we avoid recreation of Nodes in the Node_Pool and just refresh the resource?

must be replaced
+/- resource “google_container_node_pool” “pools” ***
~id = “projects/dev-gke-pci/locations/us-central1/clusters/dev-pci-native-cluster/nodePools/dev-non-pci-node-pool-f90a” ->(known after apply)
~instance_group_urls = [
-“https://www.googleapis.com/compute/v1/projects/dev-gke-pci/zones/us-central1-a/instanceGroupManagers/gke-dev-non-pci-nati-dev-non-pci-node-159eacee-grp”,
-“https://www.googleapis.com/compute/v1/projects/dev-gke-pci/zones/us-central1-b/instanceGroupManagers/gke-dev-non-pci-nati-dev-non-pci-node-fc157130-grp”,
-“https://www.googleapis.com/compute/v1/projects/dev-gke-pci/zones/us-central1-c/instanceGroupManagers/gke-dev-non-pci-nati-dev-non-pci-node-5cadf9bb-grp”,
] ->(known after apply)
~managed_instance_group_urls = [
-“https://www.googleapis.com/compute/beta/projects/dev-gke-pci/zones/us-central1-a/instanceGroups/gke-dev-non-pci-nati-dev-non-pci-node-159eacee-grp”,
-“https://www.googleapis.com/compute/beta/projects/dev-gke-pci/zones/us-central1-b/instanceGroups/gke-dev-non-pci-nati-dev-non-pci-node-fc157130-grp”,
-“https://www.googleapis.com/compute/beta/projects/dev-gke-pci/zones/us-central1-c/instanceGroups/gke-dev-non-pci-nati-dev-non-pci-node-5cadf9bb-grp”,
] ->(known after apply)

1 Like

Having the same issue, would like to know if you found a solution since it’s causing downtime recreating all instance groups each tf run