turbot/steampipe-mod-terraform-aws-compliance

Control: VPC subnet auto-assign public IP should be disabled

Description

Ensure that Amazon Virtual Private Cloud (Amazon VPC) subnets are assigned a public IP address. The control is complaint if Amazon VPC does not have subnets that are assigned a public IP address.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.vpc_subnet_auto_assign_public_ip_disabled

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std -> 'map_public_ip_on_launch') is null then 'ok'
when (attributes_std ->> 'map_public_ip_on_launch')::boolean then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std -> 'map_public_ip_on_launch') is null then ' ''map_public_ip_on_launch'' disabled'
when (attributes_std ->> 'map_public_ip_on_launch')::boolean then ' ''map_public_ip_on_launch'' enabled'
else ' ''map_public_ip_on_launch'' disabled'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'aws_subnet';

Tags