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-cloudfront-without-minimum-protocol-tls-1-2.md.
A documentation index is available at /llms.txt.
CloudFront distributions must enforce modern TLS for viewer connections to prevent interception and protocol downgrades. The Ansible community.aws.cloudfront_distribution (or cloudfront_distribution) resource must include a viewer_certificate block with minimum_protocol_version set to a TLS 1.2 variant (for example, TLSv1.2_2018 or TLSv1.2_2019).
Tasks that omit viewer_certificate or specify a minimum_protocol_version that is not a TLS 1.2 variant are flagged.
Secure configuration example:
- name:Create CloudFront distribution with TLS 1.2 minimumcommunity.aws.cloudfront_distribution:state:presentenabled:yesorigins:- id:myOrigindomain_name:origin.example.comviewer_certificate:acm_certificate_arn:arn:aws:acm:us-east-1:123456789012:certificate/abcd-ef01-2345-6789ssl_support_method:sni-onlyminimum_protocol_version:TLSv1.2_2018
Compliant Code Examples
- name:create a distribution with an origin and loggingcommunity.aws.cloudfront_distribution:state:presentcaller_reference:unique test distribution IDorigins:- id:'my test origin-000111'domain_name:www.example.comorigin_path:/productioncustom_headers:- header_name:MyCustomHeaderNameheader_value:MyCustomHeaderValuelogging:enabled:trueinclude_cookies:falsebucket:mylogbucket.s3.amazonaws.comprefix:myprefix/viewer_certificate:minimum_protocol_version:TLSv1.2_2018comment:this is a CloudFront distribution with logging
Non-Compliant Code Examples
- name:create a distribution with an origin and loggingcommunity.aws.cloudfront_distribution:state:presentcaller_reference:unique test distribution IDorigins:- id:'my test origin-000111'domain_name:www.example.comorigin_path:/productioncustom_headers:- header_name:MyCustomHeaderNameheader_value:MyCustomHeaderValuelogging:enabled:trueinclude_cookies:falsebucket:mylogbucket.s3.amazonaws.comprefix:myprefix/viewer_certificate:minimum_protocol_version:TLSv1comment:this is a CloudFront distribution with logging- name:create another distribution with an origin and loggingcommunity.aws.cloudfront_distribution:state:presentcaller_reference:unique test distribution IDorigins:- id:'my test origin-000111'domain_name:www.example.comorigin_path:/productioncustom_headers:- header_name:MyCustomHeaderNameheader_value:MyCustomHeaderValuelogging:enabled:trueinclude_cookies:falsebucket:mylogbucket.s3.amazonaws.comprefix:myprefix/viewer_certificate:minimum_protocol_version:TLSv1.1_2016comment:this is a CloudFront distribution with logging- name:create a third distributioncommunity.aws.cloudfront_distribution:state:presentcaller_reference:unique test distribution IDorigins:- id:'my test origin-000111'domain_name:www.example.comorigin_path:/productioncustom_headers:- header_name:MyCustomHeaderNameheader_value:MyCustomHeaderValuelogging:enabled:trueinclude_cookies:falsebucket:mylogbucket.s3.amazonaws.comprefix:myprefix/comment:this is a CloudFront distribution with logging
1
2
rulesets:- Ansible / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.