Skip to content

Add handwritten sweeper for google_data_loss_prevention_discovery_config #11429

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

Merged
merged 1 commit into from
Aug 13, 2024
Merged

Conversation

patrickmoy
Copy link
Member

@patrickmoy patrickmoy commented Aug 12, 2024

Addresses hashicorp/terraform-provider-google#19089.

This PR:

  • Adds a new sweeper to remove DiscoveryConfigs in the location passed by the sweeper (us-central1)
  • Creates a sweeper that does not check for unsweepable resources, as there should be only one DiscoveryConfig of each storage type per location per project, so we must delete all DiscoveryConfigs in this location and project to avoid impacting CI tests

Release Note Template for Downstream PRs (will be copied)


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

@modular-magician
Copy link
Collaborator

Tests analytics

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

Click here to see the affected service packages
  • datalossprevention

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

@patrickmoy patrickmoy marked this pull request as ready for review August 12, 2024 22:16
Copy link

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

@c2thorn, 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 github-actions bot requested a review from c2thorn August 12, 2024 22:16
Copy link
Member

@c2thorn c2thorn left a comment

Choose a reason for hiding this comment

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

Were you able to test this locally? Would you happen to have a log of it deleting something

log.Printf("[INFO][SWEEPER_LOG] %s resource name was nil", resourceName)
return nil
}

Copy link
Member

@c2thorn c2thorn Aug 12, 2024

Choose a reason for hiding this comment

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

can we add a comment for why we don't care about checking for a sweepable-prefix?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, lines 79-80. Also squashed into 1 commit.

@github-actions github-actions bot requested a review from c2thorn August 12, 2024 22:49
@patrickmoy
Copy link
Member Author

I just tested successfully with logs — here's the breakdown.

  1. Created a fresh DiscoveryConfig in my test project, note the resource name 6564684080044951644 on the last line.
  2. New discovery config is visible in pantheon UI in list of configs.
  3. Ran sweeper locally, with attached gpaste log and matching resource name.
  4. Discovery config is no longer seen in pantheon since it's been deleted

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

@modular-magician
Copy link
Collaborator

Tests analytics

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

Click here to see the affected service packages
  • datalossprevention

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

Copy link
Member

@c2thorn c2thorn left a comment

Choose a reason for hiding this comment

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

thank you!

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.

3 participants