google_compute_networks resource
Syntax
A google_compute_networks is used to test a Google Network 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_networks(project: 'chef-gcp-inspec') do
its('network_names') { should include 'inspec-network' }
end
Test that there are no more than a specified number of networks available for the project
describe google_compute_networks(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
Test that an expected network identifier is present in the project
describe google_compute_networks(project: 'chef-inspec-gcp') do
its('network_ids') { should include 12345678975432 }
end
Test that an expected network name is available for the project
describe google_compute_networks(project: 'chef-inspec-gcp') do
its('network_names') { should include "network-name" }
end
Properties
Properties that can be accessed from the google_compute_networks resource:
See google_compute_network for more detailed information.
descriptions: an array ofgoogle_compute_networkdescriptiongateway_ipv4s: an array ofgoogle_compute_networkgateway_ipv4network_ids: an array ofgoogle_compute_networkidnetwork_names: an array ofgoogle_compute_networknamesubnetworks: an array ofgoogle_compute_networksubnetworksauto_create_subnetworks: an array ofgoogle_compute_networkauto_create_subnetworkscreation_timestamps: an array ofgoogle_compute_networkcreation_timestamprouting_configs: an array ofgoogle_compute_networkrouting_configpeerings: an array ofgoogle_compute_networkpeeringsmtus: an array ofgoogle_compute_networkmtu
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.