turbot/terraform_aws_compliance

Query: cloudtrail_enabled_all_regions

Usage

powerpipe query terraform_aws_compliance.query.cloudtrail_enabled_all_regions

Steampipe Tables

SQL

select
address as resource,
case
when (attributes_std ->> 'is_multi_region_trail') is null
or (attributes_std ->> 'is_multi_region_trail') :: boolean = 'false' then 'alarm'
when (attributes_std ->> 'enable_logging') is null
or (attributes_std ->> 'enable_logging') :: boolean = 'false' then 'alarm'
when (
attributes_std -> 'event_selector' ->> 'read_write_type'
) :: text <> 'All' then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std ->> 'is_multi_region_trail') is null
or (attributes_std ->> 'is_multi_region_trail') :: boolean = 'false' then ' multi region trails not enabled'
when (attributes_std ->> 'enable_logging') is null
or (attributes_std ->> 'enable_logging') :: boolean = 'false' then ' logging disabled'
when (
attributes_std -> 'event_selector' ->> 'read_write_type'
) :: text <> 'All' then ' not enbaled for all events'
else ' logging enabled for ALL events'
end || '.' reason,
path || ':' || start_line
from
terraform_resource
where
type = 'aws_cloudtrail';

Controls

The query is being used by the following controls: