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

feat(HNS folders): add new resources to support HNS folders #12101

Open
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

gurusai-voleti
Copy link
Contributor

@gurusai-voleti gurusai-voleti commented Oct 23, 2024

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

`google_storage_new_resource`

@modular-magician
Copy link
Collaborator

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 ( 1 file changed, 354 insertions(+))
google-beta provider: Diff ( 1 file changed, 354 insertions(+))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

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 ( 1 file changed, 354 insertions(+))
google-beta provider: Diff ( 1 file changed, 354 insertions(+))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Tests analytics

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

Click here to see the affected service packages
  • storage

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

Tests analytics

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

Click here to see the affected service packages
  • storage

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

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 ( 1 file changed, 353 insertions(+))
google-beta provider: Diff ( 1 file changed, 353 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 109
Passed tests: 100
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

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 ( 5 files changed, 692 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 692 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 111
Passed tests: 100
Skipped tests: 9
Affected tests: 2

Click here to see the affected service packages
  • storage

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccStorageFolder_storageFolderBasicExample
  • TestAccStorageFolder_storageFolderBasicForceDestroy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Several tests terminated during RECORDING mode.

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

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 ( 5 files changed, 692 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 692 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 111
Passed tests: 100
Skipped tests: 9
Affected tests: 2

Click here to see the affected service packages
  • storage

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccStorageFolder_storageFolderBasicExample
  • TestAccStorageFolder_storageFolderBasicForceDestroy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccStorageFolder_storageFolderBasicForceDestroy [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccStorageFolder_storageFolderBasicExample [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

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 ( 4 files changed, 552 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 4 files changed, 552 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))

Missing test report

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

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

resource "google_storage_folder" "primary" {
  bucket        = # value needed
  force_destroy = # value needed
  name          = # value needed
  recursive     = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 110
Passed tests: 101
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

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 ( 4 files changed, 552 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 4 files changed, 552 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))

Missing test report

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

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

resource "google_storage_folder" "primary" {
  bucket        = # value needed
  force_destroy = # value needed
  name          = # value needed
  recursive     = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 110
Passed tests: 101
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 106
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 818 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 818 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

1 similar comment
@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 818 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 818 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 106
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 106
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@kautikdk
Copy link
Member

You can remove hand-written files if MMV1 source code is enough for the feature support.

@gurusai-voleti
Copy link
Contributor Author

You can remove hand-written files if MMV1 source code is enough for the feature support.

Delete, import, update are customised operations so I kept the handwritten tmpl file and updated the yaml with custom_code attribute

@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 853 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 853 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

1 similar comment
@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 853 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 853 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 100
Skipped tests: 9
Affected tests: 6

Click here to see the affected service packages
  • storage

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccStorageFolder_DeleteEmptyFolderWithForceDestroyDefault
  • TestAccStorageFolder_FailDeleteNonEmptyFolder
  • TestAccStorageFolder_FolderForceDestroy
  • TestAccStorageFolder_hnsDisabled
  • TestAccStorageFolder_storageFolderBasic
  • TestAccStorageFolder_storageFolderBasicExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccStorageFolder_DeleteEmptyFolderWithForceDestroyDefault [Debug log]
TestAccStorageFolder_FailDeleteNonEmptyFolder [Debug log]
TestAccStorageFolder_FolderForceDestroy [Debug log]
TestAccStorageFolder_hnsDisabled [Debug log]
TestAccStorageFolder_storageFolderBasic [Debug log]
TestAccStorageFolder_storageFolderBasicExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 100
Skipped tests: 9
Affected tests: 6

Click here to see the affected service packages
  • storage

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccStorageFolder_DeleteEmptyFolderWithForceDestroyDefault
  • TestAccStorageFolder_FailDeleteNonEmptyFolder
  • TestAccStorageFolder_FolderForceDestroy
  • TestAccStorageFolder_hnsDisabled
  • TestAccStorageFolder_storageFolderBasic
  • TestAccStorageFolder_storageFolderBasicExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccStorageFolder_DeleteEmptyFolderWithForceDestroyDefault [Debug log]
TestAccStorageFolder_FailDeleteNonEmptyFolder [Debug log]
TestAccStorageFolder_FolderForceDestroy [Debug log]
TestAccStorageFolder_hnsDisabled [Debug log]
TestAccStorageFolder_storageFolderBasic [Debug log]
TestAccStorageFolder_storageFolderBasicExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

# The API returns values with trailing slashes, even if not
# provided. Enforcing trailing slashes prevents diffs and ensures
# consistent output.
validation:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may want some more rigorous validation here, mainly because it is used on the path. Do you know what the user will see if they provide a name like /example_dir/? If it results in a cryptic error, then validation might be better, and then you may want to do other things like ensure alphanumeric characters or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the path starts with /, the API validates the request body and rejects it as it cannot be started with /

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but what I'm asking about is how exactly it responds when that value is rejected. For example, a 404 would be difficult for a user to understand when they actually need to remove a leading slash here.

Comment on lines +3 to +7
if d.Get("force_destroy") != nil {
if err := d.Set("force_destroy", d.Get("force_destroy")); err != nil {
return fmt.Errorf("Error updating force_destroy: %s", err)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIt: Since you're already adding this, you may want to go ahead and add the function that checks if this is the only field being changed (in case other fields are added later).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now this should be fine

break // 0 items, folder empty
}

if !d.Get("force_destroy").(bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend moving this to the beginning, since you should be able to escape early

Copy link
Contributor Author

@gurusai-voleti gurusai-voleti Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we first check if the folder contains any objects, if no objects we delete the folder either force_destory set to true or false, if any objects found and force_destory set to true then we delete the objects otherwise break out of the loop, so breaking out of loop depends on count of objects in bucket

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for clarifying, I was mixing this up with how prevent_destroy would be working.

@github-actions github-actions bot requested a review from roaks3 December 11, 2024 05:38
@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 852 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 852 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 105
Skipped tests: 9
Affected tests: 1

Click here to see the affected service packages
  • storage

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccStorageFolder_DeleteEmptyFolderWithForceDestroyDefault

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccStorageFolder_DeleteEmptyFolderWithForceDestroyDefault [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 853 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 853 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 106
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

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 ( 6 files changed, 853 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 853 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 69 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 116 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 115
Passed tests: 106
Skipped tests: 9
Affected tests: 0

Click here to see the affected service packages
  • storage

🟢 All tests passed!

View the build log

Copy link

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

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

Successfully merging this pull request may close these issues.

4 participants