turbot/steampipe-mod-terraform-aws-compliance

Control: Elastic Beanstalk enhanced health reporting should be enabled

Description

This control checks whether Elastic Beanstalk environments have enhanced health reporting enabled.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.elasticbeanstalk_environment_use_enhanced_health_checks

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when jsonb_typeof(attributes_std -> 'setting') = 'array' and exists(select 1 from jsonb_array_elements(attributes_std -> 'setting') as setting where (setting ->> 'namespace') = 'aws:elasticbeanstalk:healthreporting:system' and (setting ->> 'name') = 'HealthStreamingEnabled' and (setting ->> 'value')::boolean) then 'ok'
when jsonb_typeof(attributes_std -> 'setting') = 'object' and (attributes_std -> 'setting' ->> 'namespace') = 'aws:elasticbeanstalk:healthreporting:system' and (attributes_std -> 'setting' ->> 'name') = 'HealthStreamingEnabled' and (attributes_std -> 'setting' ->> 'value')::boolean then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when jsonb_typeof(attributes_std -> 'setting') = 'array' and exists(select 1 from jsonb_array_elements(attributes_std -> 'setting') as setting where (setting ->> 'namespace') = 'aws:elasticbeanstalk:healthreporting:system' and (setting ->> 'name') = 'HealthStreamingEnabled' and (setting ->> 'value')::boolean) then ' health streaming enabled'
when jsonb_typeof(attributes_std -> 'setting') = 'object' and (attributes_std -> 'setting' ->> 'namespace') = 'aws:elasticbeanstalk:healthreporting:system' and (attributes_std -> 'setting' ->> 'name') = 'HealthStreamingEnabled' and (attributes_std -> 'setting' ->> 'value')::boolean then ' health streaming enabled'
else ' health streaming disabled'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_elastic_beanstalk_environment';

Tags