Terraform always replaces GKE autopilot even though there’s no change in the code.
Is this bug? Does anyone know how to avoid it?
Terraform Version
v1.0.8
Prerequisites
I made a gke cluster by calling terraform apply
with the following code.
resource "google_container_cluster" "default" {
name = "test"
location = "asia-northeast1"
network = {id of existing vpc}
subnetwork = {id of existing subnetwork}
enable_autopilot = true
node_config {
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/monitoring",
]
}
}
Expected Behavior
When I exec terrafrom plan
with the above same code, terraform shows there’s no change and terraform won’t do anything.
Actual Behavior
When I exec terrafrom plan
with the above same code, terraform says it will replace (destroy & create) the gke cluster even though there’s no change.
If the code doens’t have node_config
, it won’t happen.
Steps to Reproduce
- write the above code
- call
terraform init
- call
terraform apply
- call
terraform apply
again