turbot/steampipe-mod-terraform-aws-compliance

Control: S3 bucket logging should be enabled

Description

Amazon Simple Storage Service (Amazon S3) server access logging provides a method to monitor the network for potential cybersecurity events.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.s3_bucket_logging_enabled

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'logging' -> 'target_bucket') is null then 'alarm'
when coalesce(trim(attributes_std -> 'logging' ->> 'target_bucket'), '') = '' then 'alarm'
else 'ok'
end as status,
split_part(address, '.', 2) || case
when (attributes_std -> 'logging' -> 'target_bucket') is null then ' ''target_bucket'' is not defined'
when coalesce(trim(attributes_std -> 'logging' ->> 'target_bucket'), '') = '' then ' logging disabled'
else ' logging enabled'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_s3_bucket';

Tags