google_compute_instance_group

Use the google_compute_instance_group InSpec audit resource to test properties of a single GCP compute instance group.


Syntax

A google_compute_instance_group resource block declares the tests for a single GCP compute instance group by project, zone and name.

describe google_compute_instance_group(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'gcp-inspec-test') do
  it { should exist }
  its('size') { should eq 2 }
end


Examples

The following examples show how to use this InSpec audit resource.

Test that a GCP compute instance group has the expected size

describe google_compute_instance_group(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'gcp-inspec-test') do
  its('size') { should eq 2 }
end

Test that a GCP compute instance group has a port with supplied name and value

describe google_compute_instance_group(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'gcp-inspec-test') do
  its('port_name') { should eq "http" }
  its('port_value') { should eq 80 }
end


Properties

  • creation_timestamp, description, fingerprint, id, kind, name, named_ports, network, size, subnetwork, zone


GCP Permissions

Ensure the Compute Engine API is enabled for the project where the resource is located.