Skip to content

Add data source for retrieving all organizations #12740

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

Conversation

bestefreund
Copy link
Contributor

@bestefreund bestefreund commented Jan 13, 2025

Adds a new data source "google_organizations", allowing to retrieve all organizations.

Fixes: hashicorp/terraform-provider-google#20890

Release Note Template for Downstream PRs (will be copied)

`google_organizations`

@github-actions github-actions bot requested a review from SirGitsalot January 13, 2025 15:30
Copy link

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

@SirGitsalot, 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 modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jan 13, 2025
@bestefreund bestefreund force-pushed the feature/data_source_google_organizations branch from 892e230 to d6cc18c Compare January 13, 2025 16:52
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jan 13, 2025
Copy link
Member

@SirGitsalot SirGitsalot left a comment

Choose a reason for hiding this comment

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

One comment, hopefully easy to resolve. Thanks!

@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, 178 insertions(+))
google-beta provider: Diff ( 4 files changed, 178 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 160
Passed tests: 129
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

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
  • TestAccEphemeralServiceAccountKey_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccEphemeralServiceAccountKey_basic [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

@bestefreund bestefreund force-pushed the feature/data_source_google_organizations branch from d6cc18c to 44df95c Compare January 14, 2025 19:00
@github-actions github-actions bot requested a review from SirGitsalot January 14, 2025 19:01
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jan 14, 2025
@bestefreund bestefreund force-pushed the feature/data_source_google_organizations branch from 44df95c to c6da0f5 Compare January 14, 2025 19:02
Copy link
Member

@SirGitsalot SirGitsalot left a comment

Choose a reason for hiding this comment

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

Sorry, one more nit. I kicked off the tests for this change to make sure it works with our CI organizations. Thanks again!

err = request.Pages(context.Background(), func(organizationList *cloudresourcemanager.SearchOrganizationsResponse) error {
for _, organization := range organizationList.Organizations {
organizations = append(organizations, map[string]interface{}{
"directory_customer_id": organization.Owner.DirectoryCustomerId,
Copy link
Member

Choose a reason for hiding this comment

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

The API docs say that Owner is required, so it should never be nil here but for safety's sake we should check for nil before dereferencing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @SirGitsalot,

no worries.
The better the review, the better the result.

I've just added the improvement and I hope I understood you right:
https://github.com/GoogleCloudPlatform/magic-modules/compare/c6da0f5e69dcfc471d3f114283edb989aad984c8..885b464bb967cc41cec87755283e17960c7e3969

Happy weekend!

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jan 17, 2025
@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, 182 insertions(+))
google-beta provider: Diff ( 4 files changed, 182 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 160
Passed tests: 129
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

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
  • TestAccEphemeralServiceAccountKey_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccEphemeralServiceAccountKey_basic [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

@bestefreund bestefreund force-pushed the feature/data_source_google_organizations branch from c6da0f5 to 885b464 Compare January 17, 2025 17:47
@github-actions github-actions bot requested a review from SirGitsalot January 17, 2025 17:48
@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Jan 17, 2025
@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, 187 insertions(+))
google-beta provider: Diff ( 4 files changed, 187 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 160
Passed tests: 129
Skipped tests: 30
Affected tests: 1

Click here to see the affected service packages
  • resourcemanager

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
  • TestAccEphemeralServiceAccountKey_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccEphemeralServiceAccountKey_basic [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

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.

Add data source for retrieving all organizations
3 participants