turbot/steampipe-mod-terraform-aws-compliance

Control: CloudWatch alarm action should be enabled

Description

Amazon CloudWatch alarms alert when a metric breaches the threshold for a specified number of evaluation periods. The alarm performs one or more actions based on the value of the metric or expression relative to a threshold over a number of time periods.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.cloudwatch_alarm_action_enabled

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_aws_compliance.control.cloudwatch_alarm_action_enabled --share

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'alarm_actions') is null
and (attributes_std -> 'insufficient_data_actions') is null
and (attributes_std -> 'ok_actions') is null then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std -> 'alarm_actions') is null
and (attributes_std -> 'insufficient_data_actions') is null
and (attributes_std -> 'ok_actions') is null then ' no action enabled'
when (attributes_std -> 'alarm_actions') is not null then ' alarm action enabled'
when (attributes_std -> 'insufficient_data_actions') is not null then ' insufficient data action enabled.'
when (attributes_std -> 'ok_actions') is not null then ' ok action enabled.'
else ' action enabled'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_cloudwatch_metric_alarm';

Tags