Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading gcp module version destroys bucket #346

Open
dspeck1 opened this issue Sep 18, 2024 · 1 comment
Open

Upgrading gcp module version destroys bucket #346

dspeck1 opened this issue Sep 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dspeck1
Copy link

dspeck1 commented Sep 18, 2024

TL;DR

Upgraded terraform-google-cloud storage version from 1.7.0 to the latest 6.1.0 and getting this error. I am not using a list in my code.

  # google_storage_bucket_iam_binding.cutouts-bucket-ro-iam-binding must be replaced
-/+ resource "google_storage_bucket_iam_binding" "cutouts-bucket-ro-iam-binding" {
      ~ bucket  = "b/rubin-cutouts-dev-us-central1-output" -> "rubin-cutouts-dev-output" # forces replacement
      ~ etag    = "CAs=" -> (known after apply)
      ~ id      = "b/rubin-cutouts-dev-us-central1-output/roles/storage.objectViewer" -> (known after apply)
        # (2 unchanged attributes hidden)

Expected behavior

Upgrade the provider version and not have terraform delete the bucket.

Observed behavior

Terraform wants to delete the bucket.

Terraform Configuration

module "gcs_bucket" {
  source  = "terraform-google-modules/cloud-storage/google"
  version = ">= 6.1.0"

  project_id           = var.project_id
  names                = var.suffix_name
  prefix               = var.prefix_name
  set_admin_roles      = var.set_admin_roles
  admins               = var.admins
  versioning           = var.versioning
  bucket_policy_only   = var.bucket_policy_only
  bucket_admins        = var.bucket_admins
  bucket_creators      = var.bucket_creators
  bucket_viewers       = var.bucket_viewers
  creators             = var.creators
  encryption_key_names = var.encryption_key_names
  folders              = var.folders
  force_destroy        = var.force_destroy
  labels               = var.labels
  lifecycle_rules      = var.lifecycle_rules
  location             = var.location
  set_creator_roles    = var.set_creator_roles
  set_viewer_roles     = var.set_viewer_roles
  storage_class        = var.storage_class
  viewers              = var.viewers
}

Terraform Version

terraform version
Terraform v1.9.5
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v5.44.0
+ provider registry.terraform.io/hashicorp/google-beta v5.44.0
+ provider registry.terraform.io/hashicorp/null v3.2.3
+ provider registry.terraform.io/hashicorp/random v3.6.3
+ provider registry.terraform.io/hashicorp/template v2.2.

Additional information

No response

@dspeck1 dspeck1 added the bug Something isn't working label Sep 18, 2024
@daniel-cit
Copy link
Contributor

Hi @dspeck1 thanks for your report.

The Terraform Google Cloud Storage Module uses Semantic Versioning for the releases created, which means there are braking changes from v1 to v6.

Your case looks like the change describe in the documentation regarding Upgrading to v4.0.

Cloud you try the instructions and see if they fix your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants