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

cloudfront_distribution: now honours the enabled setting #1824

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- cloudfront_distribution - now honours the ``enabled`` setting (https://github.com/ansible-collections/community.aws/issues/1823).
2 changes: 1 addition & 1 deletion plugins/modules/cloudfront_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2218,7 +2218,7 @@ def validate_common_distribution_parameters(
config["aliases"] = ansible_list_to_cloudfront_list(aliases)
if logging is not None:
config["logging"] = self.validate_logging(logging)
config["enabled"] = enabled or config.get("enabled", self.__default_distribution_enabled)
config["enabled"] = enabled if enabled is not None else config.get("enabled", self.__default_distribution_enabled)
if price_class is not None:
self.validate_attribute_with_allowed_values(price_class, "price_class", self.__valid_price_classes)
config["price_class"] = price_class
Expand Down
15 changes: 14 additions & 1 deletion tests/integration/targets/cloudfront_distribution/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
- set_fact:
distribution_id: '{{ cf_distribution.id }}'

- name: ensure that default value of 'enabled' is 'true'
assert:
that:
- cf_distribution.changed
- cf_distribution.enabled

- name: ensure that default value of 'ipv6_enabled' is 'false'
assert:
that:
Expand Down Expand Up @@ -359,8 +365,9 @@
wait: true
state: absent

- name: create cloudfront distribution with tags
- name: create cloudfront distribution with tags and as disabled
cloudfront_distribution:
enabled: false
origins:
- domain_name: "{{ resource_prefix }}2.example.com"
id: "{{ resource_prefix }}2.example.com"
Expand All @@ -373,6 +380,12 @@
- set_fact:
distribution_id: '{{ cf_second_distribution.id }}'

- name: ensure that the value of 'enabled' is 'false'
assert:
that:
- cf_second_distribution.changed
- not cf_second_distribution.enabled

- name: ensure tags were set on creation
assert:
that:
Expand Down