Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 1.93 KB

google_compute_address.md

File metadata and controls

63 lines (39 loc) · 1.93 KB
title platform
About the google_compute_address Resource
gcp

google_compute_address

Use the google_compute_address InSpec audit resource to test properties of a single GCP compute address.


Syntax

A google_compute_address resource block declares the tests for a single GCP compute address by project, region and name.

describe google_compute_address(project: 'chef-inspec-gcp', location: 'europe-west2', name: 'compute-address') do
  it { should exist }
  its('name') { should eq 'compute-address' }
  its('region') { should match 'europe-west2' }
end

Examples

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

Test that a GCP compute address IP exists

describe google_compute_address(project: 'chef-inspec-gcp', location: 'europe-west2', name: 'compute-address') do
  its('address_ip_exists')  { should be true }
end

Test that a GCP compute address is in a particular status

describe google_compute_address(project: 'chef-inspec-gcp', location: 'europe-west2', name: 'compute-address') do
  its('status') { should eq "IN_USE" }
end

Test that a GCP compute address IP has the expected number of users

describe google_compute_address(project: 'chef-inspec-gcp', location: 'europe-west2', name: 'compute-address') do
  its('user_count') { should eq 1 }
end

Test that the first user of a GCP compute address has the expected resource name

describe google_compute_address(project: 'chef-inspec-gcp', location: 'europe-west2', name: 'compute-address') do
  its('user_resource_name') { should eq "gcp_ext_vm_name" }
end

Properties

  • address, creation_timestamp, description, id, kind, name, region, status, users

GCP Permissions

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