feat(compute): support self_link input for google_compute_network data source#17393
Conversation
…a source The `google_compute_network` data source previously required `name` to look up a network. This adds support for looking up a network by `self_link`, which is useful when you have a self_link from another resource and want to look up network details without parsing the name. Changes: - `name` is now Optional+Computed (was Required) - `self_link` is now Optional+Computed (was Computed only) - `project` is now Computed in addition to Optional - Read function parses project and name from self_link when provided - Validates that either `name` or `self_link` is provided Includes unit tests for self_link parsing. Fixes hashicorp/terraform-provider-google#7863
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @trodge, 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. |
|
@trodge This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit b28207c: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @raman1236, @trodge VCR tests complete for b28207c! |
|
@GoogleCloudPlatform/terraform-team @trodge This PR has been waiting for review for 1 week. Please take a look! Use the label |
|
@GoogleCloudPlatform/terraform-team @trodge This PR has been waiting for review for 2 weeks. Please take a look! Use the label |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit f3d6770: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode 🟢 All tests passed in Replaying mode! No Recording was needed. View the replaying VCR build log @raman1236, @trodge VCR tests complete for f3d6770! |
4cb1b71
…a source (GoogleCloudPlatform#17393) Co-authored-by: raman1236 <25852516+raman1236@users.noreply.github.com>
…a source (GoogleCloudPlatform#17393) Co-authored-by: raman1236 <25852516+raman1236@users.noreply.github.com>
Description
The
data_source_google_compute_networkdata source previously only supported looking up a network by its shortname. This meant users who had aself_link(e.g. from another resource output or from an import) had to manually extract the name before using the data source.This change updates the data source to detect when the
namefield is a self_link and extract the name from it, using the same logic as the existingCompareSelfLinkOrResourceNamediff-suppress function.Bug
Fixes hashicorp/terraform-provider-google#7863
Tests
Includes unit tests for self_link parsing (full URL, partial path, beta API).
Files changed
mmv1/third_party/terraform/services/compute/data_source_google_compute_network.gommv1/third_party/terraform/services/compute/data_source_google_compute_network_internal_test.go(new)