turbot/steampipe-mod-terraform-aws-compliance

Control: ELB load balancer listeners should use a secure protocol

Description

Ensure that your load balancer listeners are configured with a secure protocol including redirections.

Usage

Run the control in your terminal:

powerpipe control run terraform_aws_compliance.control.elb_lb_use_secure_protocol_listener

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
address as resource,
case
when (attributes_std ->> 'protocol') like any (array ['HTTPS', 'TLS', 'TCP', 'UDP', 'TCP_UDP']) then 'ok'
when (attributes_std -> 'default_action' ->> 'type') = 'redirect' and (attributes_std -> 'default_action' -> 'redirect' ->> 'protocol') = 'HTTPS' then 'ok'
else 'alarm'
end status,
split_part(address, '.', 2) || case
when (attributes_std ->> 'protocol') like any (array ['HTTPS', 'TLS', 'TCP', 'UDP', 'TCP_UDP']) then ' listener configured with ' || (attributes_std ->> 'protocol') || ' secure protocol'
when (attributes_std -> 'default_action' ->> 'type') = 'redirect' and (attributes_std -> 'default_action' -> 'redirect' ->> 'protocol') = 'HTTPS' then ' listener configured with ' || (attributes_std -> 'default_action' ->> 'type') || ' and ' || (attributes_std -> 'default_action' -> 'redirect' ->> 'protocol') || ' secure protocol'
else ' listener not configured with any secured protocol'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type in ('aws_lb_listener', 'aws_alb_listener');

Tags