turbot/terraform_aws_compliance

Query: vpc_flow_logs_enabled

Usage

powerpipe query terraform_aws_compliance.query.vpc_flow_logs_enabled

Steampipe Tables

SQL

with flow_logs as (
select
attributes_std ->> 'vpc_id' as flow_log_vpc_id
from
terraform_resource
where
type = 'aws_flow_log'
), all_vpc as (
select
'\$\{aws_vpc.' || name || '.id}' as vpc_id,
*
from
terraform_resource
where
type = 'aws_vpc'
)
select
a.address as resource,
case
when b.flow_log_vpc_id is not null then 'ok'
else 'alarm'
end as status,
split_part(a.address, '.', 2) || case
when b.flow_log_vpc_id is not null then ' flow logging enabled'
else ' flow logging disabled'
end || '.' reason
, path || ':' || start_line
from
all_vpc as a
left join flow_logs as b on a.vpc_id = b.flow_log_vpc_id;

Controls

The query is being used by the following controls: