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

fix(storage-bucket-object): do not delete object on update content, j… #18479

Conversation

modular-magician
Copy link
Collaborator

The aim of this is to avoid object deletion on content update, linked to #10488

before this PR :

# google_storage_bucket_object.gsn-psc-informations must be replaced
-/+ resource "google_storage_bucket_object" "test" {
      ~ content          = (sensitive value) # forces replacement
      ~ content_type     = "text/plain; charset=utf-8" -> (known after apply)
      ~ crc32c           = "+Yfdfw==" -> (known after apply)
      ~ detect_md5hash   = "4zoxBKTWpq0ORYqR4FRpCg==" -> "different hash" # forces replacement
      - event_based_hold = false -> null
      ~ id               = "test-test" -> (known after apply)
      ~ kms_key_name     = "projects/myproject/locations/myregion/keyRings/mykeyring/cryptoKeys/mykeyname/cryptoKeyVersions/1" -> (known after apply)
      ~ md5hash          = "4zoxBKTWpq0ORYqR4FRpCg==" -> (known after apply)
      ~ media_link       = "https://storage.googleapis.com/download/storage/v1/b/test/o/test?generation=1708531718170806&alt=media" -> (known after apply)
      - metadata         = {} -> null
        name             = "test"
      ~ output_name      = "test" -> (known after apply)
      ~ self_link        = "https://www.googleapis.com/storage/v1/b/test/o/test" -> (known after apply)
      ~ storage_class    = "STANDARD" -> (known after apply)
      - temporary_hold   = false -> null
        # (1 unchanged attribute hidden)
    }

After this PR :

# google_storage_bucket_object.gsn-psc-informations must be replaced
~ resource "google_storage_bucket_object" "test" {
      ~ content          = (sensitive value) 
      ~ detect_md5hash   = "4zoxBKTWpq0ORYqR4FRpCg==" -> "different hash" 
          id               = "test-test"
          name             = "test"
    }

you can test it with : https://github.com/public-cloud-wl/terraform-provider-google/releases/tag/v5.17.3
registry link : https://registry.terraform.io/providers/public-cloud-wl/google/latest

Release Note Template for Downstream PRs (will be copied)

storage: The update on `google_storage_bucket_object` content is now no more delete to create object, but just push a new object if the content change

Derived from GoogleCloudPlatform/magic-modules#10038

hashicorp#10038)

[upstream:672734df9f9288e14d854871815242b7af410e9f]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 1d88bb8 into hashicorp:main Jun 18, 2024
2 checks passed
@tanvipanchal-edf
Copy link

tanvipanchal-edf commented Jun 26, 2024

While using this provider version, its failing with below -

│ Error: Provider produced inconsistent final plan

│ When expanding the plan for google_storage_bucket_object.kubeconfig to
│ include new values learned so far during apply, provider
│ "registry.terraform.io/hashicorp/google" produced an invalid new value for
│ .detect_md5hash: was cty.StringVal("different hash"), but now
│ cty.StringVal("ZndE4b6y617AZSEAQdDH8w==").

This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants