Description
monitoring_config.enable_components causes a permanent diff on every terraform plan because the GCP API returns the components in a different order than Terraform sends them.
Steps to reproduce
- Create a GKE cluster with
monitoring_enabled_components = ["DEPLOYMENT", "HPA", "POD", "STATEFULSET", "STORAGE", "SYSTEM_COMPONENTS"]
- Run
terraform apply — succeeds
- Run
terraform plan — shows a diff reordering the list
Expected behavior
No diff after a successful apply.
Actual behavior
~ enable_components = [
- "SYSTEM_COMPONENTS",
- "STORAGE",
+ "DEPLOYMENT",
"HPA",
"POD",
- "DEPLOYMENT",
"STATEFULSET",
+ "STORAGE",
+ "SYSTEM_COMPONENTS",
]
Suggested fix
Use sort() on enable_components in cluster.tf line 115, or convert to TypeSet in the provider schema.
Versions
terraform-google-kubernetes-engine v44.0.0
hashicorp/google ~> 7.0
- Terraform >= 1.5.0
Description
monitoring_config.enable_componentscauses a permanent diff on everyterraform planbecause the GCP API returns the components in a different order than Terraform sends them.Steps to reproduce
monitoring_enabled_components = ["DEPLOYMENT", "HPA", "POD", "STATEFULSET", "STORAGE", "SYSTEM_COMPONENTS"]terraform apply— succeedsterraform plan— shows a diff reordering the listExpected behavior
No diff after a successful apply.
Actual behavior
Suggested fix
Use
sort()onenable_componentsincluster.tfline 115, or convert toTypeSetin the provider schema.Versions
terraform-google-kubernetes-enginev44.0.0hashicorp/google~> 7.0