Terraform always replaces GKE autopilot even though there’s no code change

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

  1. write the above code
  2. call terraform init
  3. call terraform apply
  4. call terraform apply again

Did you ever resolve this? Nearly 2 years later and I’m experiencing the same thing, even though I don’t have the node_config options set. My config is very simple and is as follows:

resource “google_container_cluster” “cluster” {
name = var.service_name
location = var.region
node_locations = var.node_locations

network = var.network
subnetwork = var.subnet

Enabling Autopilot for this cluster

enable_autopilot = true
}

The service_name is “cluster” the same as the cluster.

While it takes over 8 minutes to apply this simple config and create the cluster, if I do a “terraform plan” and “terraform apply” immediately afterward, without changing anything, it replaces the cluster by destroying it and creating it again.