A google_compute_instances is used to test a Google Instance resource
This resource has beta fields available. To retrieve these fields, include beta: true in the constructor for the resource
describe google_compute_instances(project: 'chef-gcp-inspec', zone: 'zone') do
its('instance_names') { should include 'inspec-instance' }
end
describe google_compute_instances(project: 'chef-inspec-gcp', zone: 'europe-west2-a') do
its('count') { should be <= 100}
end
describe google_compute_instances(project: 'chef-inspec-gcp', zone: 'europe-west2-a') do
its('instance_ids.count') { should cmp 9 }
end
describe google_compute_instances(project: 'chef-inspec-gcp', zone: 'europe-west2-a') do
its('instance_names') { should include "my-favorite-instance" }
end
Properties that can be accessed from the google_compute_instances resource:
See the google_compute_instance resource for more information.
can_ip_forwardsgoogle_compute_instance can_ip_forwardcpu_platformsgoogle_compute_instance cpu_platformcreation_timestampsgoogle_compute_instance creation_timestampdeletion_protectionsgoogle_compute_instance deletion_protectiondisksgoogle_compute_instance disksguest_acceleratorsgoogle_compute_instance guest_acceleratorshostnamesgoogle_compute_instance hostnameinstance_idsgoogle_compute_instance idlabel_fingerprintsgoogle_compute_instance label_fingerprintlabelsgoogle_compute_instance labelsmetadatagoogle_compute_instance metadatamachine_typesgoogle_compute_instance machine_typemin_cpu_platformsgoogle_compute_instance min_cpu_platforminstance_namesgoogle_compute_instance namenetwork_interfacesgoogle_compute_instance network_interfacesschedulingsgoogle_compute_instance schedulingservice_accountsgoogle_compute_instance service_accountsshielded_instance_configsgoogle_compute_instance shielded_instance_configstatusesgoogle_compute_instance statusstatus_messagesgoogle_compute_instance status_messagetagsgoogle_compute_instance tagszonesgoogle_compute_instance zoneThis resource supports all of the above properties as filter criteria, which can be used with where as a block or a method.
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_instances/