shlogg · Early preview
Nomi3 @nomi3

Resolving Terraform Destroy Issues With Google Cloud Resources

When managing Google Cloud resources with Terraform, set force_destroy to true on the relevant Cloud Storage bucket & update only that resource before running terraform destroy again. This resolves issues with partially deleted resources.

When managing Google Cloud resources with Terraform, you may encounter a situation where destroying development environment resources fails because force_destroy is set to false on a Cloud Storage bucket. As a result, some resources remain in a partially deleted state. Here’s how to resolve this issue.

  
  
  Versions

Terraform: 1.10.4
hashicorp/google: 6.16.0


  
  
  Steps

First, set force_destroy to true on the relevant Cloud Storage bucket:

resource "google_storage_bucket" "example" {
  name     = "example-bucket"
  location = "US"
  // force_destroy = false
  force_destroy = true
}...