Open leg100 opened 5 years ago
b/262517887
I've looked into this issue and it seems like we need to add support for a new datasource google_compute_usable_subnetworks
that lists all the usable subnetworks within a project.
google_compute_usable_subnetworks
https://compute.googleapis.com/compute/v1/projects/{project}/aggregated/subnetworks/listUsable
google_compute_addresses
that lists IP addresses in the project that might be helpful. This datasource has been added in this PR.google_compute_addresses
datasource, this new datasource should be using the filter
field so that we can filter resources listed in the response.If we don't use any filters, the List Usable Subnetworks API operates without any issues. However, I discovered that the filter query parameter is not working as expected. I've tried using the API explorer to pass the filter query parameter, but instead of receiving a filtered result, I'm getting a list of all usable subnetworks. I attempted to add this datasource, which can provide an aggregated list of all usable subnetworks in the project, however in order to make it function, the filter query parameter in the API has to be fixed. This commit contains my implementation of the datasource file, which might be useful for creating this datasource when the filter problem is fixed.
Community Note
Description
I would like a data source that returns a list of 'usable subnets', as returned by the command:
gcloud compute networks subnets list-usable
The command is documented here.
This is particularly useful for a 'service project' in a Shared VPC: a user may want to lookup which subnets are available on which a compute instance can be provisioned for their service project.
New or Affected Resource(s)
Potential Terraform Configuration
References