Skip to content

Migrated compute regions to use transport_tpg.SendRequest#16986

Open
jcromanu wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
jcromanu:data_source_google_compute_regions
Open

Migrated compute regions to use transport_tpg.SendRequest#16986
jcromanu wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
jcromanu:data_source_google_compute_regions

Conversation

@jcromanu
Copy link
Copy Markdown

@jcromanu jcromanu commented Apr 6, 2026

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

compute: migrated `data_source_google_compute_regions` to use direct HTTP rather than a client library

@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@rileykarson, 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 rileykarson April 6, 2026 21:34
@rileykarson
Copy link
Copy Markdown
Member

Please remediate CLA issues

@jcromanu jcromanu force-pushed the data_source_google_compute_regions branch 3 times, most recently from 557cbec to e36898e Compare April 7, 2026 03:58
@slevenick slevenick requested review from slevenick and removed request for rileykarson April 7, 2026 23:13
@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 7, 2026
@modular-magician
Copy link
Copy Markdown
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, 22 insertions(+), 10 deletions(-))
google-beta provider: Diff ( 1 file changed, 22 insertions(+), 10 deletions(-))

@modular-magician
Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 1405
Passed tests: 1314
Skipped tests: 90
Affected tests: 1

Click here to see the affected service packages
  • compute

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

Get to know how VCR tests work

@modular-magician
Copy link
Copy Markdown
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccComputeRegions_basic [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

}

regions := flattenRegions(resp.Items)
regions := flattenRegions(res["items"].([]interface{}))
Copy link
Copy Markdown

@WentaoNi WentaoNi Apr 9, 2026

Choose a reason for hiding this comment

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

The current implementation uses direct type assertions that will cause a panic if the API response does not match the expected structure or if the items list is missing.

Recommendation: Use the "comma-ok" assertion pattern:

var regions []string
if rawItems, ok := res["items"].([]interface{}); ok {
    regions = flattenRegions(rawItems)
}

result := make([]string, len(regions))
for i, region := range regions {
result[i] = region.Name
regionMap := region.(map[string]interface{})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add safety checks to ensure region is a map and name is a string before asserting, see example:

var items []map[string]interface{}
if rawItems, ok := res["items"].([]interface{}); ok {
    for _, rawItem := range rawItems {
        // ...
    }
}

@jcromanu jcromanu force-pushed the data_source_google_compute_regions branch from e36898e to 61c1b96 Compare April 10, 2026 04:31
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 10, 2026
@github-actions
Copy link
Copy Markdown

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

@jcromanu jcromanu force-pushed the data_source_google_compute_regions branch from 61c1b96 to 986c365 Compare April 10, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants