google_project_metric

Use the google_project_metric InSpec audit resource to test properties of a single GCP project metric.


Syntax

A google_project_metric resource block declares the tests for a single GCP zone by project and name.

describe google_project_metric(project: 'chef-inspec-gcp',  metric: 'metric_name') do
  it { should exist }
end


Examples

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

Test that a GCP project metric exists

describe google_project_metric(project: 'chef-inspec-gcp',  metric: 'metric_name') do
  it { should exist }
end

Test that a GCP compute zone has an expected CPU platform

describe google_project_metric(project: 'chef-inspec-gcp',  metric: 'metric_name') do
  its('filter') { should eq "(protoPayload.serviceName=\"cloudresourcemanager.googleapis.com\")" }
end


Properties

  • filter, name, metric_descriptor


GCP Permissions

Ensure the Stackdriver Logging API is enabled for the project.