Skip to content

Terraform wants to replaces(destroy & create) GKE autopilot  #15484

Description

@StarpTech

Terraform Version

Terraform v1.5.5
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v4.77.0

Affected Resource(s)

  • google_container_cluster

Terraform Configuration Files

variable "gke_username" {
  default     = ""
  description = "gke username"
}

variable "gke_password" {
  default     = ""
  description = "gke password"
}

# GKE cluster
resource "google_container_cluster" "primary" {
  name     = "${var.project_id}-gke"
  location = var.region

  network    = google_compute_network.vpc.name
  subnetwork = google_compute_subnetwork.subnet.name

  # Enabling Autopilot for this cluster
  enable_autopilot = true
}

Expected Behavior

Terraform should not destroy my cluster when nothing has changed.

Actual Behavior

google_container_cluster.primary must be replaced

Terraform wants to destroy my cluster, even though I haven't changed a single line of Terraform code.

Steps to Reproduce

Please follow https://www.hashicorp.com/blog/terraform-adds-support-for-gke-autopilot after successfully provisioning all resources run terraform apply again.

Running terraform apply -refresh-only shows no changes.

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions