-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add data source for retrieving all organizations #12740
Conversation
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. |
892e230
to
d6cc18c
Compare
There was a problem hiding this 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!
mmv1/third_party/terraform/services/resourcemanager/data_source_google_organizations.go
Outdated
Show resolved
Hide resolved
Tests analyticsTotal tests: 160 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
d6cc18c
to
44df95c
Compare
44df95c
to
c6da0f5
Compare
There was a problem hiding this 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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
Tests analyticsTotal tests: 160 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
c6da0f5
to
885b464
Compare
Tests analyticsTotal tests: 160 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
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)