Skip to content

Commit

Permalink
compute: added subnetwork_id to compute subnet data source (#12461)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyardley authored Dec 11, 2024
1 parent 904cffa commit 85d0502
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 @@ -100,6 +104,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 @@ -47,6 +47,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
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

0 comments on commit 85d0502

Please sign in to comment.