Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http3 support in cloudfront_distribution module #1753

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/1753-cloudfront-add-http3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- cloudfront_distribution - add ``http3`` support via parameter value ``http2and3`` for parameter ``http_version`` (https://github.com/ansible-collections/community.aws/pull/1753).
41 changes: 11 additions & 30 deletions plugins/modules/cloudfront_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@
description:
- The version of the http protocol to use for the distribution.
- AWS defaults this to C(http2).
- Valid values are C(http1.1) and C(http2).
- Valid values are C(http1.1), C(http2), C(http3) and C(http2and3).
type: str

ipv6_enabled:
Expand Down Expand Up @@ -1617,35 +1617,16 @@ def __init__(self, module):
self.__valid_methods_cached_methods[1],
self.__valid_methods
]
self.__valid_lambda_function_association_event_types = set([
'viewer-request',
'viewer-response',
'origin-request',
'origin-response'
])
self.__valid_viewer_certificate_ssl_support_methods = set([
'sni-only',
'vip'
])
self.__valid_viewer_certificate_minimum_protocol_versions = set([
'SSLv3',
'TLSv1',
'TLSv1_2016',
'TLSv1.1_2016',
'TLSv1.2_2018',
'TLSv1.2_2019',
'TLSv1.2_2021'
])
self.__valid_viewer_certificate_certificate_sources = set([
'cloudfront',
'iam',
'acm'
])
self.__valid_http_versions = set([
'http1.1',
'http2'
])
self.__s3_bucket_domain_identifier = '.s3.amazonaws.com'
self.__valid_lambda_function_association_event_types = set(
["viewer-request", "viewer-response", "origin-request", "origin-response"]
)
self.__valid_viewer_certificate_ssl_support_methods = set(["sni-only", "vip"])
self.__valid_viewer_certificate_minimum_protocol_versions = set(
["SSLv3", "TLSv1", "TLSv1_2016", "TLSv1.1_2016", "TLSv1.2_2018", "TLSv1.2_2019", "TLSv1.2_2021"]
)
self.__valid_viewer_certificate_certificate_sources = set(["cloudfront", "iam", "acm"])
self.__valid_http_versions = set(["http1.1", "http2", "http3", "http2and3"])
self.__s3_bucket_domain_identifier = ".s3.amazonaws.com"

def add_missing_key(self, dict_object, key_to_set, value_to_set):
if key_to_set not in dict_object and value_to_set is not None:
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/targets/cloudfront_distribution/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@
# - not cf_update_ipv6.changed
- cf_update_ipv6.is_ipv6_enabled

- name: Ensure that default value of 'http_version' is 'http2'
assert:
that:
- cf_update_ipv6.http_version == 'http2'

- name: Update the distribution http_version to http2and3
cloudfront_distribution:
state: present
distribution_id: "{{ distribution_id }}"
http_version: http2and3
register: cf_update_http_version

- name: Ensure that default value of 'http_version' is 'http2and3'
assert:
that:
- cf_update_http_version.changed
- cf_update_http_version.http_version == 'http2and3'

# - name: re-run cloudfront distribution with same defaults
# cloudfront_distribution:
# distribution_id: "{{ distribution_id }}"
Expand Down