Skip to content
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

compute: added subnetwork_id to compute subnet data source #8893

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/12461.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: added `subnetwork_id` to `google_compute_subnetwork` data source
```
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func DataSourceGoogleComputeSubnetwork() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"subnetwork_id": {
Type: schema.TypeInt,
Computed: true,
},
"ip_cidr_range": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -98,6 +102,10 @@ func dataSourceGoogleComputeSubnetworkRead(d *schema.ResourceData, meta interfac
return transport_tpg.HandleDataSourceNotFoundError(err, d, fmt.Sprintf("Subnetwork Not Found : %s", name), id)
}

if err := d.Set("subnetwork_id", subnetwork.Id); err != nil {
return fmt.Errorf("Error setting subnetwork_id: %s", err)
}

if err := d.Set("ip_cidr_range", subnetwork.IpCidrRange); err != nil {
return fmt.Errorf("Error setting ip_cidr_range: %s", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func testAccDataSourceGoogleSubnetworkCheck(data_source_name string, resource_na
"id",
"name",
"description",
"subnetwork_id",
"ip_cidr_range",
"private_ip_google_access",
"internal_ipv6_prefix",
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/compute_subnetwork.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ In addition to the arguments listed above, the following attributes are exported
* `network` - The network name or resource link to the parent
network of this subnetwork.

* `subnetwork_id` - The numeric ID of the resource.

* `description` - Description of this subnetwork.

* `ip_cidr_range` - The IP address range that machines in this
Expand Down
Loading