turbot/steampipe-mod-terraform-aws-compliance

Control: VPC internet gateways should be attached to authorized VPC

Description

Manage access to resources in the AWS Cloud by ensuring that internet gateways are only attached to authorized Amazon Virtual Private Cloud (Amazon VPC).

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.vpc_igw_attached_to_authorized_vpc

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when name in (select split_part((attributes_std ->> 'vpc_id')::text, '.', 2) from terraform_resource where type = 'aws_internet_gateway') then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when name in (select split_part((attributes_std ->> 'vpc_id')::text, '.', 2) from terraform_resource where type = 'aws_internet_gateway') then ' has internet gateway attachment(s)'
else ' has no internet gateway attachment(s)'
end || '.' as reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_vpc';

Tags