On this page
google_compute_subnetworks resource
Syntax
A google_compute_subnetworks is used to test a Google Subnetwork resource
Beta Resource
This resource has beta fields available. To retrieve these fields, include beta: true in the constructor for the resource
Examples
describe google_compute_subnetworks(project: 'chef-gcp-inspec', region: 'europe-west2') do
its('ip_cidr_ranges') { should include '10.2.0.0/16' }
its('subnetwork_names') { should include 'inspec-subnet' }
end
Test that there are no more than a specified number of subnetworks available for the project and region
describe google_compute_subnetworks(project: 'chef-inspec-gcp', region: 'europe-west2') do
its('count') { should be <= 100}
end
Test that an expected subnetwork identifier is present in the project and region
describe google_compute_subnetworks(project: 'chef-inspec-gcp', region: 'europe-west2') do
its('subnetwork_ids') { should include 12345678975432 }
end
Test that an expected subnetwork name is available for the project and region
describe google_compute_subnetworks(project: 'chef-inspec-gcp', region: 'europe-west2') do
its('subnetwork_names') { should include "subnetwork-name" }
end
Test that an expected subnetwork network name is not present for the project and region
describe google_compute_subnetworks(project: 'chef-inspec-gcp', region: 'europe-west2') do
its('subnetwork_networks') { should not include "network-name" }
end
Properties
Properties that can be accessed from the google_compute_subnetworks resource:
See the google_compute_subnetwork resource for more information.
-
creation_timestamps -
an array of
google_compute_subnetworkcreation_timestamp -
descriptions -
an array of
google_compute_subnetworkdescription -
gateway_addresses -
an array of
google_compute_subnetworkgateway_address -
subnetwork_ids -
an array of
google_compute_subnetworkid -
ip_cidr_ranges -
an array of
google_compute_subnetworkip_cidr_range -
subnetwork_names -
an array of
google_compute_subnetworkname -
networks -
an array of
google_compute_subnetworknetwork -
purposes -
(Beta only) an array of
google_compute_subnetworkpurpose -
roles -
(Beta only) an array of
google_compute_subnetworkrole -
secondary_ip_ranges -
an array of
google_compute_subnetworksecondary_ip_ranges -
private_ip_google_accesses -
an array of
google_compute_subnetworkprivate_ip_google_access -
regions -
an array of
google_compute_subnetworkregion -
log_configs -
an array of
google_compute_subnetworklog_config
Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used with where as a block or a method.
GCP Permissions
Ensure the Compute Engine API is enabled for the current project.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_compute_subnetworks/