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..
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 AWS principal will need the CloudWatch:Client:GetDashboardOutput
action with Effect
set to Allow
.