Skip to content

feat(compute): support self_link input for google_compute_network data source#17393

Open
raman1236 wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
raman1236:feat/compute-network-self-link-input
Open

feat(compute): support self_link input for google_compute_network data source#17393
raman1236 wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
raman1236:feat/compute-network-self-link-input

Conversation

@raman1236
Copy link
Copy Markdown

Description

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 out the name yourself.

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

New or Affected Resource(s)

  • google_compute_network (data source)

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.go
  • mmv1/third_party/terraform/services/compute/data_source_google_compute_network_internal_test.go (new)

…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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

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.

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.

Support self_link as an input for google_compute_network data source

2 participants