Skip to content

Latest commit

 

History

History
50 lines (30 loc) · 1.51 KB

google_compute_image.md

File metadata and controls

50 lines (30 loc) · 1.51 KB
title platform
About the google_compute_image Resource
gcp

google_compute_image

Use the google_compute_image InSpec audit resource to test properties of a single GCP compute image. This resource will attempt to retrieve a project custom image then image from a family before giving up.


Syntax

A google_compute_image resource block declares the tests for a single GCP compute image by project and name.

describe google_compute_image(project: 'chef-inspec-gcp', name: 'image-1') do
  it { should exist }
  its('name') { should eq 'image-1' }
end

Examples

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

Test that a GCP compute image is in a particular status e.g. "READY" means available for use

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

Test that a GCP compute image has the expected family

describe google_compute_image(project: 'chef-inspec-gcp', name: 'ubuntu') do
  its('family') { should match "ubuntu" }
end

Properties

  • archive_size_bytes, creation_timestamp, description, disk_size_gb, family, guest_os_features, id, kind, label_fingerprint, licenses, name, raw_disk, source_type, status

GCP Permissions

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