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

Add resources for Cloud Logging default settings #9409

Merged
merged 13 commits into from
Dec 14, 2023

Conversation

zachberger
Copy link
Member

@zachberger zachberger commented Nov 6, 2023

Add resources for Cloud Logging default settings.
Fixes: hashicorp/terraform-provider-google#15827

Release Note Template for Downstream PRs (will be copied)

`google_logging_folder_settings`
`google_logging_organization_settings`

@modular-magician
Copy link
Collaborator

Hello! I am a robot. It looks like you are a: Community Contributor Googler Core Contributor. Tests will run automatically.

@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.

@modular-magician
Copy link
Collaborator

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

Breaking Change Detection Failed

The breaking change detector crashed during execution. This is usually due to the downstream provider(s) failing to compile. Please investigate or follow up with your reviewer.

Diff report

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

Terraform GA: Diff ( 10 files changed, 1867 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 10 files changed, 1867 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 3 files changed, 223 insertions(+))

@c2thorn
Copy link
Member

c2thorn commented Nov 6, 2023

Hi @zachberger,
I was assigned as a reviewer, but I see this is in draft mode. If you wish to have me review, please ping me again and mark the pull request as "Ready for review"

@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.

Terraform GA: Diff ( 5 files changed, 1008 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 5 files changed, 1008 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 188 insertions(+))

Missing test report

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

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

resource "google_logging_folder_settings" "primary" {
  disable_default_sink   = # value needed
  folder                 = # value needed
  kms_key_name           = # value needed
  kms_service_account_id = # value needed
  storage_location       = # value needed
}

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

resource "google_logging_organization_settings" "primary" {
  disable_default_sink = # value needed
  kms_key_name         = # value needed
  organization         = # value needed
  storage_location     = # value needed
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3225
Passed tests 2896
Skipped tests: 329
Affected tests: 0

$\textcolor{green}{\textsf{All tests passed in REPLAYING mode.}}$
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.

Terraform GA: Diff ( 7 files changed, 1272 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 7 files changed, 1272 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))
TF OiCS: Diff ( 8 files changed, 236 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3227
Passed tests 2896
Skipped tests: 329
Affected tests: 2

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
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample|TestAccLoggingFolderSettings_loggingFolderSettingsExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample[Error message] [Debug log]
TestAccLoggingFolderSettings_loggingFolderSettingsExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these 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.

Terraform GA: Diff ( 7 files changed, 1272 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 7 files changed, 1272 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))
TF OiCS: Diff ( 8 files changed, 236 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3227
Passed tests 2895
Skipped tests: 329
Affected tests: 3

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccLoggingFolderSettings_loggingFolderSettingsExample|TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample|TestAccDataSourceGoogleServiceAccountJwt

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDataSourceGoogleServiceAccountJwt[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccLoggingFolderSettings_loggingFolderSettingsExample[Error message] [Debug log]
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@zachberger zachberger force-pushed the settings branch 2 times, most recently from 0834a51 to 5728d2c Compare November 10, 2023 19:05
@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.

Terraform GA: Diff ( 7 files changed, 1276 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 7 files changed, 1276 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 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.

Terraform GA: Diff ( 7 files changed, 1276 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 7 files changed, 1276 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3227
Passed tests 2895
Skipped tests: 329
Affected tests: 3

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccDataprocClusterIamPolicy|TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample|TestAccLoggingFolderSettings_loggingFolderSettingsExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDataprocClusterIamPolicy[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample[Error message] [Debug log]
TestAccLoggingFolderSettings_loggingFolderSettingsExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these 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.

Terraform GA: Diff ( 11 files changed, 1662 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 12 files changed, 1667 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@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.

Terraform GA: Diff ( 13 files changed, 1844 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 1844 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@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.

Terraform GA: Diff ( 13 files changed, 1744 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 1744 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3230
Passed tests 2896
Skipped tests: 329
Affected tests: 5

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccHealthcareDatasetIamPolicy|TestAccLoggingFolderSettings_datasource|TestAccLoggingProjectSettings_datasource|TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample|TestAccLoggingFolderSettings_loggingFolderSettingsExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccHealthcareDatasetIamPolicy[Debug log]
TestAccLoggingFolderSettings_datasource[Debug log]
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample[Debug log]
TestAccLoggingFolderSettings_loggingFolderSettingsExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$
TestAccLoggingFolderSettings_loggingFolderSettingsExample[Error message] [Debug log]
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample[Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccLoggingProjectSettings_datasource[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these 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.

Terraform GA: Diff ( 13 files changed, 1744 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 1744 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3230
Passed tests 2897
Skipped tests: 329
Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsExample|TestAccLoggingFolderSettings_loggingFolderSettingsExample|TestAccLoggingProjectSettings_datasource|TestAccDataSourceGoogleServiceAccountIdToken_impersonation

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{The provider crashed while running the VCR tests in RECORDING mode}}$
$\textcolor{red}{\textsf{Please fix it 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.

Terraform GA: Diff ( 13 files changed, 1744 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 1744 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccLoggingFolderSettings_loggingFolderSettingsOnlyDisableDefaultExample[Debug log]
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyCmekExample[Debug log]
TestAccLoggingFolderSettings_loggingFolderSettingsAllExample[Debug log]
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsAllExample[Debug log]
TestAccLoggingFolderSettings_loggingFolderSettingsOnlyCmekExample[Debug log]
TestAccLoggingFolderSettings_loggingFolderSettingsOnlyLocationExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyDisableDefaultExample[Error message] [Debug log]
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyLocationExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these 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.

Terraform GA: Diff ( 9 files changed, 1624 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 9 files changed, 1624 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3300
Passed tests 2961
Skipped tests: 337
Affected tests: 2

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
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyDisableDefaultExample|TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyLocationExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyLocationExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccLoggingOrganizationSettings_loggingOrganizationSettingsOnlyDisableDefaultExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@zachberger
Copy link
Member Author

zachberger commented Dec 12, 2023

Is there any way to remove t.Parallel from autogenerated tests?

@roaks3
Copy link
Contributor

roaks3 commented Dec 12, 2023

No, you would have to implement the test as an update* test.

Looking at what you have, you might want to consider dropping some of the variants you have, to reduce the number of tests and eliminate the chance for conflicting tests.

For example:

  • folder tests: a full example, and an update test with 2 steps: start with only required fields and update to specify all fields
  • org tests: a full example with skip_test: true, and an update test with 2 steps: start with only required fields and update to specify all fields. There would only be one org test with this setup, so you would not need to worry about conflicts

@roaks3
Copy link
Contributor

roaks3 commented Dec 12, 2023

FWIW, everything besides those remaining tests LGTM at this point

@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.

Terraform GA: Diff ( 8 files changed, 1181 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 8 files changed, 1181 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@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.

Terraform GA: Diff ( 8 files changed, 1181 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 8 files changed, 1181 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3293
Passed tests 2952
Skipped tests: 338
Affected tests: 3

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccDataprocClusterIamPolicy|TestAccLoggingOrganizationSettings_update|TestAccLoggingFolderSettings_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDataprocClusterIamPolicy[Debug log]
TestAccLoggingOrganizationSettings_update[Debug log]
TestAccLoggingFolderSettings_update[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

Copy link
Contributor

@roaks3 roaks3 left a comment

Choose a reason for hiding this comment

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

Few remaining comments, but code LGTM and tests look good too. Main blocker is verifying that the updateMask isn't doing something unintended like clearing existing fields that are not set by the user.

Copy link
Contributor

@roaks3 roaks3 left a comment

Choose a reason for hiding this comment

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

Whoops, forgot to submit the comments in the previous review

mmv1/products/logging/FolderSettings.yaml Show resolved Hide resolved
mmv1/products/logging/OrganizationSettings.yaml Outdated Show resolved Hide resolved
@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.

Terraform GA: Diff ( 8 files changed, 1181 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 8 files changed, 1181 insertions(+), 2 deletions(-))
TF Conversion: Diff ( 2 files changed, 178 insertions(+))

@zachberger
Copy link
Member Author

If we haven't checked already, we should make sure existing fields aren't being cleared before this is merged.

I did a manual tests of this:

  1. I started with the full resource then went down the the minimal resource, the values in GCP were left unchanged.
  2. Created just the minimal resource (specifying just the folder or organization), the values in GCP were left unchanged.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3295
Passed tests 2957
Skipped tests: 338
Affected tests: 0

$\textcolor{green}{\textsf{All tests passed in REPLAYING mode.}}$
View the build log

@zachberger
Copy link
Member Author

Thanks @roaks3!

@zachberger zachberger deleted the settings branch December 18, 2023 17:36
kapreus pushed a commit to kapreus/magic-modules that referenced this pull request Jan 2, 2024
…#9409)

* Add folder and organization setting resources

* Try GetTestOrgTargetFromEnv instead of GetTestOrgFromEnv.

* Use correct organization for testing.

* Remove key rotation to fix VCR test.

* Don't specify fields matching default values.

* Specify true instead of yes.

* Use BootstrapKMSKeyInLocation instead of creating new keys.

* Add missing quotes

* Add additional examples to generate additional tests.

* Remove unneeded resources from examples.

* Simplify tests to be one full resource creation and one update.

* Fix typo in test

* Document and cleanup example.
balanaguharsha pushed a commit to balanaguharsha/magic-modules that referenced this pull request May 2, 2024
…#9409)

* Add folder and organization setting resources

* Try GetTestOrgTargetFromEnv instead of GetTestOrgFromEnv.

* Use correct organization for testing.

* Remove key rotation to fix VCR test.

* Don't specify fields matching default values.

* Specify true instead of yes.

* Use BootstrapKMSKeyInLocation instead of creating new keys.

* Add missing quotes

* Add additional examples to generate additional tests.

* Remove unneeded resources from examples.

* Simplify tests to be one full resource creation and one update.

* Fix typo in test

* Document and cleanup example.
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.

google_logging_folder_settings / google_logging_organization_settings new resources
6 participants