magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

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

Open Maarc-D opened this issue 1 year ago • 8 comments

The aim of this is to avoid object deletion on content update, linked to https://github.com/hashicorp/terraform-provider-google/issues/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

Maarc-D avatar Feb 23 '24 16:02 Maarc-D

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Feb 23 '24 16:02 google-cla[bot]

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@BBBmau, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

github-actions[bot] avatar Feb 23 '24 16:02 github-actions[bot]

/gcbrun

BBBmau avatar Feb 27 '24 16:02 BBBmau

@BBBmau seems that you are required for review ;)

Maarc-D avatar Mar 04 '24 10:03 Maarc-D

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 1 file changed, 45 insertions(+), 35 deletions(-)) Terraform Beta: Diff ( 1 file changed, 45 insertions(+), 35 deletions(-))

modular-magician avatar Mar 04 '24 16:03 modular-magician

Tests analytics

Total tests: 89 Passed tests: 83 Skipped tests: 6 Affected tests: 0

Click here to see the affected service packages
  • storage

$\textcolor{green}{\textsf{All tests passed!}}$ View the build log

modular-magician avatar Mar 04 '24 16:03 modular-magician

@Maarc-D i appreciate the patience! Checks seem to be good, I'll do a more thorough test before approving this.

BBBmau avatar Mar 04 '24 17:03 BBBmau

Hello @rileykarson @BBBmau can you please help us triggering the checks again? Seems we're possibly at one step from merging this :)

LucaPrete avatar Apr 29 '24 12:04 LucaPrete

@GoogleCloudPlatform/terraform-team This PR has been waiting for review for 3 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar May 22 '24 09:05 github-actions[bot]

/gcbrun

BBBmau avatar May 22 '24 15:05 BBBmau

Hello @BBBmau @rileykarson it seems tests are stuck somewhere. Any chance you can please help us with this?

LucaPrete avatar May 24 '24 18:05 LucaPrete

@melinath this may fall under the contributions rotation? At least the membership checker error

rileykarson avatar May 28 '24 18:05 rileykarson

The membership checker error is due to this PR being extremely old - @Maarc-D you will need to either merge the main branch into the PR branch or rebase the PR branch.

melinath avatar May 28 '24 18:05 melinath

@GoogleCloudPlatform/terraform-team This PR has been waiting for review for 4 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar May 29 '24 09:05 github-actions[bot]

The membership checker error is due to this PR being extremely old - @Maarc-D you will need to either merge the main branch into the PR branch or rebase the PR branch.

I did sync the fork ;)

Maarc-D avatar Jun 03 '24 13:06 Maarc-D

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 108 insertions(+), 35 deletions(-)) google-beta provider: Diff ( 2 files changed, 108 insertions(+), 35 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_storage_bucket_object (185 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_storage_bucket_object" "primary" {
  detect_md5hash = # value needed
}

modular-magician avatar Jun 03 '24 18:06 modular-magician

Tests analytics

Total tests: 94 Passed tests: 88 Skipped tests: 6 Affected tests: 0

Click here to see the affected service packages
  • storage

Non-exercised tests

Tests were added that are skipped in VCR:

  • TestResourceStorageBucketObjectUpdate_ContentChange

$\textcolor{green}{\textsf{All tests passed!}}$ View the build log

modular-magician avatar Jun 03 '24 18:06 modular-magician

This would be such a helpful change. Would it help if someone opened a new PR? I understand this PR is pretty old.

mtander avatar Jun 04 '24 17:06 mtander

This PR has been waiting for review for 2 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jun 05 '24 09:06 github-actions[bot]

This would be such a helpful change. Would it help if someone opened a new PR? I understand this PR is pretty old.

I'm not sure a duplicate PR will help, but you can put a thumb up on this one ;) I did sync my fork so no matter the time the PR is open it should be up to date.

@BBBmau will take care of it, I hope ^^

Maarc-D avatar Jun 05 '24 12:06 Maarc-D

can you run the command below in order to resolve the lint check errors?

==> Checking that code complies with gofmt requirements...
gofmt needs running on the following files:
./google/services/storage/resource_storage_bucket_object.go
You can use the command: `make fmt` to reformat code.
make: *** [GNUmakefile:26: fmtcheck] Error 1

BBBmau avatar Jun 05 '24 16:06 BBBmau

can you run the command below in order to resolve the lint check errors?

==> Checking that code complies with gofmt requirements...
gofmt needs running on the following files:
./google/services/storage/resource_storage_bucket_object.go
You can use the command: `make fmt` to reformat code.
make: *** [GNUmakefile:26: fmtcheck] Error 1

@BBBmau done ;)

Maarc-D avatar Jun 06 '24 14:06 Maarc-D

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 106 insertions(+), 33 deletions(-)) google-beta provider: Diff ( 2 files changed, 106 insertions(+), 33 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_storage_bucket_object (185 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_storage_bucket_object" "primary" {
  detect_md5hash = # value needed
}


modular-magician avatar Jun 07 '24 00:06 modular-magician

Tests analytics

Total tests: 94 Passed tests: 88 Skipped tests: 6 Affected tests: 0

Click here to see the affected service packages
  • storage

Non-exercised tests

Tests were added that are skipped in VCR:

  • TestResourceStorageBucketObjectUpdate_ContentChange

$\textcolor{green}{\textsf{All tests passed!}}$ View the build log

modular-magician avatar Jun 07 '24 00:06 modular-magician

can you run the command below in order to resolve the lint check errors?

==> Checking that code complies with gofmt requirements...
gofmt needs running on the following files:
./google/services/storage/resource_storage_bucket_object.go
You can use the command: `make fmt` to reformat code.
make: *** [GNUmakefile:26: fmtcheck] Error 1

@BBBmau done ;)

only thing left is to add a test that includes detect_md5hash which is mentioned in the previous comments from magic magician. After that I can approve and get this merged (:

BBBmau avatar Jun 07 '24 00:06 BBBmau

@BBBmau I did not add this field ;) But with my modification I think this one should be computed, I tried to add the argument but do you know how I can trigger @modular-magician to make the checks ?

Maarc-D avatar Jun 07 '24 06:06 Maarc-D

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 111 insertions(+), 35 deletions(-)) google-beta provider: Diff ( 2 files changed, 111 insertions(+), 35 deletions(-))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_storage_bucket_object (185 total tests) Please add an acceptance test which includes these fields. The test should include the following:

resource "google_storage_bucket_object" "primary" {
  detect_md5hash = # value needed
}


modular-magician avatar Jun 07 '24 22:06 modular-magician

Tests analytics

Total tests: 0 Passed tests: 0 Skipped tests: 0 Affected tests: 0

Click here to see the affected service packages
  • storage

Non-exercised tests

Tests were added that are skipped in VCR:

  • TestResourceStorageBucketObjectUpdate_ContentChange

$\textcolor{red}{\textsf{Errors occurred during REPLAYING mode. Please fix them to complete your PR.}}$ View the build log

modular-magician avatar Jun 07 '24 22:06 modular-magician

@rileykarson @BBBmau This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jun 13 '24 09:06 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson @BBBmau This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jun 17 '24 09:06 github-actions[bot]