For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/ansible-aws-alb-listening-on-http.md.
A documentation index is available at /llms.txt.
Application Load Balancers (ALB) must terminate TLS and use HTTPS listeners to protect traffic in transit and prevent interception or downgrade attacks. Serving application traffic over plain HTTP exposes credentials and sensitive data to eavesdropping.
For Ansible ALB resources (modules amazon.aws.elb_application_lb and elb_application_lb), ensure the listeners[].Protocol property is set to "HTTPS". Resources missing the Protocol property or with Protocol set to any value other than "HTTPS" are flagged. When using HTTPS, also configure a valid TLS certificate (for example via Certificates: - CertificateArn: ...) or implement an HTTP listener only to perform redirects to HTTPS rather than serving plaintext.
Secure configuration example:
- name:Create ALB with HTTPS listeneramazon.aws.elb_application_lb:name:my-albstate:presentlisteners:- Protocol:HTTPSPort:443Certificates:- CertificateArn:arn:aws:acm:us-east-1:123456789012:certificate/abcdef01-2345-6789-abcd-ef0123456789DefaultActions:- Type:forwardTargetGroupArn:arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/my-tg/abcdef0123456789