Skip to main content

aws_cloudwatch_dashboard Resource

Use the aws_cloudwatch_dashboard InSpec audit resource to test properties of the plural AWS CloudWatch dashboard.

For additional information, including details on parameters and properties, see the AWS documentation on AWS CloudWatch Dashboard..

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure that the dashboard exists.

describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do
  it { should exist }
end

Parameters

dashboard_name (required)

The name of a dashboard.

Properties

dashboard_arn
The Amazon Resource Name (ARN) of the dashboard.
dashboard_body
The detailed information about the dashboard, including what widgets are included and their location on the dashboard.
dashboard_name
The name of the dashboard.

Examples

Ensure a dashboard ARN is available.

describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do
  its('dashboard_arn') { should eq 'ARN' }
end

Ensure a dashboard body is available.

describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do
    its('dashboard_body') { should eq 'BODY' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

This resource has the following special matchers.

exist

Use should to test that the entity exists.

describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_cloudwatch_dashboard(dashboard_name: 'DASHBOARD_NAME') do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the CloudWatch:Client:GetDashboardOutput action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×