PARALLAX

cloudfront_response_headers_policy

Create, update and delete response headers policies to be used in a Cloudfront distribution

Collection: community.aws

Full Name: community.aws.cloudfront_response_headers_policy

Synopsis

Create, update and delete response headers policies to be used in a Cloudfront distribution

Parameters

NameTypeRequiredDefaultDescription
access_keystr
aws_ca_bundlepath
aws_configdict
commentstr
cors_configdictmap[]
custom_headers_configdictmap[]
debug_botocore_endpoint_logsboolfalse
endpoint_urlstr
namestryes
profilestr
regionstr
secret_keystr
security_headers_configdictmap[]
session_tokenstr
statestrpresent
validate_certsbooltrue

Example

yaml
- name: Creationg a Cloudfront header policy using all predefined header features and a custom header for demonstration
  community.aws.cloudfront_response_headers_policy:
    name: my-header-policy
    comment: My header policy for all the headers
    cors_config:
        access_control_allow_origins:
            items:
                - 'https://foo.com/bar'
                - 'https://bar.com/foo'
        access_control_allow_headers:
            items:
                - 'X-Session-Id'
        access_control_allow_methods:
            items:
                - GET
                - OPTIONS
                - HEAD
        access_control_allow_credentials: true
        access_control_expose_headers:
            items:
                - 'X-Session-Id'
        access_control_max_age_sec: 1800
        origin_override: true
    security_headers_config:
        xss_protection:
            protection: true
            report_uri: 'https://my.report-uri.com/foo/bar'
            override: true
        frame_options:
            frame_option: 'SAMEORIGIN'
            override: true
        referrer_policy:
            referrer_policy: 'same-origin'
            override: true
        content_security_policy:
            content_security_policy: "frame-ancestors 'none'; report-uri https://my.report-uri.com/r/d/csp/enforce;"
            override: true
        content_type_options:
            override: true
        strict_transport_security:
            include_subdomains: true
            preload: true
            access_control_max_age_sec: 63072000
            override: true
    custom_headers_config:
        items:
            - {header: 'X-Test-Header', value: 'Foo', override: true}
    state: present

- name: Delete header policy
  community.aws.cloudfront_response_headers_policy:
    name: my-header-policy
    state: absent
Search
    ↑ ↓ move↵ openesc close