-
Notifications
You must be signed in to change notification settings - Fork 398
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
New Modules: cloudfront_cache_policy
and cloudfront_origin_request_policy
#2046
Open
Zozman
wants to merge
80
commits into
ansible-collections:main
Choose a base branch
from
Zozman:cloudfrontCreateCacheAndOriginPolicy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
fe55eec
New Module: cloudfront_cache_policy
Zozman 2eb76d0
New Module: cloudfront_cache_policy
Zozman 0e849cb
Merge branch 'cloudfrontCreateCacheAndOriginPolicy' of github.com:Zoz…
Zozman 3e5e53c
New Module: cloudfront_cache_policy
Zozman 6239cf7
New Module: cloudfront_cache_policy
Zozman 79a883f
New Module: cloudfront_cache_policy
Zozman 07d8d8c
New Module: cloudfront_cache_policy
Zozman 8e0dbfc
New Module: cloudfront_origin_request_policy
Zozman 4800216
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman 2135acf
cloudfront_origin_request_policy: Fixed documentation spacing
Zozman a48828f
Merge branch 'cloudfrontCreateCacheAndOriginPolicy' of github.com:Zoz…
Zozman 1410d22
cloudfront_cache_policy: Fixed documentation spacing
Zozman 98c6aa5
cloudfront_cache_policy: Fixed documentation spacing
Zozman 96b6462
cloudfront_origin_request_policy: Fixed documentation spacing
Zozman 8da255e
cloudfront_cache_policy: Fixed code spacing
Zozman ac52b55
cloudfront_origin_request_policy: Fixed code spacing
Zozman f14cdcb
cloudfront_cache_policy: Fixed formatting
Zozman ceee2da
cloudfront_origin_request_policy: Fixed formatting
Zozman 7f57478
cloudfront_cache_policy: Fixed documentation
Zozman d12ac4a
cloudfront_origin_request_policy: Fixed examples
Zozman 424d4b3
cloudfront_cache_policy: Fixed return values
Zozman 53f8927
cloudfront_origin_request_policy: Fixed return values
Zozman 7019f41
cloudfront_origin_request_policy: Fixed spacing
Zozman 9667bfe
cloudfront_cache_policy: Fixed spacing
Zozman 6ab8821
cloudfront_origin_request_policy: Fixed line lengths
Zozman 4af9a90
cloudfront_cache_policy: Fixed line lengths
Zozman 37416cc
cloudfront_cache_policy: Fixed line lengths
Zozman f7e651f
cloudfront_cache_policy + cloudfront_origin_request_policy: Added cha…
Zozman faf6841
cloudfront_cache_policy: Updated spacing
Zozman e5fea92
cloudfront_origin_request_policy: Updated spacing
Zozman 76414d3
cloudfront_origin_request_policy: Updated spacing
Zozman bab83ba
cloudfront_cache_policy: Updated spacing
Zozman e343e46
cloudfront_cache_policy: Fixed property permissions to support deleti…
Zozman e32092d
cloudfront_origin_request_policy: Fixed property permissions to suppo…
Zozman 50a9021
cloudfront_cache_policy: Added filter to list function to make it mor…
Zozman 56da3d0
cloudfront_origin_request_policy: Added filter to list function to ma…
Zozman 8b6d180
cloudfront_cache_policy: Fixed spacing on integration test
Zozman 5f1901d
cloudfront_origin_request_policy: Fixed spacing on integration test
Zozman 844b5e1
cloudfront_cache_policy: Fixed null list error
Zozman 85bfd8f
cloudfront_origin_request_policy: Fixed null list error
Zozman 6cace09
cloudfront_cache_policy: Added filter to list function to make it mor…
Zozman cd9ab59
cloudfront_origin_request_policy: Added filter to list function to ma…
Zozman e2175a0
cloudfront_cache_policy: Added filter to list function to make it mor…
Zozman a0c8fb4
cloudfront_cache_policy: Fixed linter issues
Zozman 05e2bcf
cloudfront_origin_request_policy: Fixed linter issues
Zozman c55a12b
cloudfront_origin_request_policy: Fixed linter issues
Zozman 6842f43
cloudfront_origin_request_policy: Fixed linter issues
Zozman 3bc00bc
cloudfront_cache_policy: Fixed linter issues
Zozman 7d7148f
cloudfront_cache_policy: Check default_ttl
Zozman eb65d0b
cloudfront_cache_policy: Adjust test cases
Zozman 15ee63d
cloudfront_cache_policy: Fix recursive insertion of items quantity
Zozman 15b2617
cloudfront_cache_policy: Fix recursive insertion of items quantity
Zozman 676ef84
cloudfront_cache_policy: Fixed deletion test case
Zozman ffab414
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman 64a3ee0
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman 071e727
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman 15fffa9
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman a17f219
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman 9f115ba
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman 77724ed
Merge branch 'ansible-collections:main' into cloudfrontCreateCacheAnd…
Zozman e363d85
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 71a05f8
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman b232ee7
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman f7f9591
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 0698597
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 9a40501
Update plugins/modules/cloudfront_cache_policy.py
Zozman a5288a8
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman ea94556
Update plugins/modules/cloudfront_cache_policy.py
Zozman a9db265
Update plugins/modules/cloudfront_cache_policy.py
Zozman 969ca95
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 367284c
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 1000228
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 95a4291
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman 85eb2c2
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman a119456
Update plugins/modules/cloudfront_cache_policy.py
Zozman ee8223c
Update plugins/modules/cloudfront_cache_policy.py
Zozman f198cbe
Update plugins/modules/cloudfront_cache_policy.py
Zozman 53bbb46
Update plugins/modules/cloudfront_cache_policy.py
Zozman 6a49a10
Update plugins/modules/cloudfront_cache_policy.py
Zozman 9d49a0d
Update plugins/modules/cloudfront_origin_request_policy.py
Zozman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
changelogs/fragments/2046-cloudfront_cache_policy-cloudfront_origin_request_policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- "Added ``cloudfront_cache_policy`` and ``cloudfront_origin_request_policy`` modules (https://github.com/ansible-collections/community.aws/pull/2046)." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cloud/aws |
1 change: 1 addition & 0 deletions
1
tests/integration/targets/cloudfront_cache_policy/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dependencies: [] |
96 changes: 96 additions & 0 deletions
96
tests/integration/targets/cloudfront_cache_policy/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
|
||
- name: Integration testing for the cloudfront_cache_policy module | ||
module_defaults: | ||
group/aws: | ||
aws_access_key: '{{ aws_access_key }}' | ||
aws_secret_key: '{{ aws_secret_key }}' | ||
security_token: '{{ security_token | default(omit) }}' | ||
region: '{{ aws_region }}' | ||
block: | ||
|
||
- name: Create a simple cache policy | ||
cloudfront_cache_policy: | ||
name: "{{ resource_prefix }}-my-cache-policy" | ||
comment: Created by Ansible test | ||
default_ttl: 86400 | ||
min_ttl: 1 | ||
max_ttl: 31536000 | ||
parameters_in_cache_key_and_forwarded_to_origin: | ||
enable_accept_encoding_gzip: false | ||
enable_accept_encoding_brotli: false | ||
headers_config: | ||
header_behavior: none | ||
cookies_config: | ||
cookie_behavior: none | ||
query_strings_config: | ||
query_string_behavior: none | ||
state: present | ||
register: create_result | ||
|
||
- name: Assert creation without errors and return values | ||
assert: | ||
that: | ||
- create_result is changed | ||
- create_result is not failed | ||
- create_result.cache_policy.cache_policy_config.name == "{{ resource_prefix }}-my-cache-policy" | ||
|
||
- name: Update existing policy with more complicated configuration | ||
cloudfront_cache_policy: | ||
name: "{{ resource_prefix }}-my-cache-policy" | ||
comment: Created by Ansible test | ||
default_ttl: 86400 | ||
min_ttl: 1 | ||
max_ttl: 31536000 | ||
parameters_in_cache_key_and_forwarded_to_origin: | ||
enable_accept_encoding_gzip: true | ||
enable_accept_encoding_brotli: true | ||
headers_config: | ||
header_behavior: whitelist | ||
headers: | ||
items: | ||
- accept | ||
- accept-language | ||
- host | ||
- user-agent | ||
cookies_config: | ||
cookie_behavior: whitelist | ||
cookies: | ||
items: | ||
- my-cookie | ||
query_strings_config: | ||
query_string_behavior: whitelist | ||
query_strings: | ||
items: | ||
- my-query-string | ||
state: present | ||
register: update_result | ||
|
||
- name: Assert update and updated return values | ||
assert: | ||
that: | ||
- update_result is changed | ||
- update_result.cache_policy.cache_policy_config.parameters_in_cache_key_and_forwarded_to_origin.enable_accept_encoding_gzip == true | ||
- update_result.cache_policy.cache_policy_config.parameters_in_cache_key_and_forwarded_to_origin.enable_accept_encoding_brotli == true | ||
|
||
- name: Ensure policy is deleted | ||
cloudfront_cache_policy: | ||
name: "{{ resource_prefix }}-my-cache-policy" | ||
comment: Created by Ansible test | ||
state: absent | ||
register: delete_result | ||
|
||
- name: Assert deletion without errors | ||
assert: | ||
that: | ||
- delete_result is changed | ||
- delete_result is not failed | ||
- delete_result.cache_policy is undefined | ||
|
||
always: | ||
|
||
- name: Ensure policy is deleted | ||
cloudfront_cache_policy: | ||
name: "{{ resource_prefix }}-my-cache-policy" | ||
state: absent | ||
ignore_errors: true |
1 change: 1 addition & 0 deletions
1
tests/integration/targets/cloudfront_origin_request_policy/aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cloud/aws |
1 change: 1 addition & 0 deletions
1
tests/integration/targets/cloudfront_origin_request_policy/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dependencies: [] |
84 changes: 84 additions & 0 deletions
84
tests/integration/targets/cloudfront_origin_request_policy/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
|
||
- name: Integration testing for the cloudfront_origin_request_policy module | ||
module_defaults: | ||
group/aws: | ||
aws_access_key: '{{ aws_access_key }}' | ||
aws_secret_key: '{{ aws_secret_key }}' | ||
security_token: '{{ security_token | default(omit) }}' | ||
region: '{{ aws_region }}' | ||
block: | ||
|
||
- name: Create a simple origin request policy | ||
cloudfront_origin_request_policy: | ||
name: "{{ resource_prefix }}-my-origin-request-policy" | ||
comment: Created by Ansible test | ||
headers_config: | ||
header_behavior: none | ||
cookies_config: | ||
cookie_behavior: none | ||
query_strings_config: | ||
query_string_behavior: none | ||
state: present | ||
register: create_result | ||
|
||
- name: Assert creation without errors and return values | ||
assert: | ||
that: | ||
- create_result is changed | ||
- create_result is not failed | ||
- create_result.origin_request_policy.origin_request_policy_config.name == "{{ resource_prefix }}-my-origin-request-policy" | ||
|
||
- name: Update existing policy with more complicated configuration | ||
cloudfront_origin_request_policy: | ||
name: "{{ resource_prefix }}-my-origin-request-policy" | ||
comment: Created by Ansible test | ||
headers_config: | ||
header_behavior: whitelist | ||
headers: | ||
items: | ||
- accept | ||
- accept-language | ||
- host | ||
- user-agent | ||
cookies_config: | ||
cookie_behavior: whitelist | ||
cookies: | ||
items: | ||
- my-cookie | ||
query_strings_config: | ||
query_string_behavior: whitelist | ||
query_strings: | ||
items: | ||
- my-query-string | ||
state: present | ||
register: update_result | ||
|
||
- name: Assert update and updated return values | ||
assert: | ||
that: | ||
- update_result is changed | ||
- update_result.origin_request_policy.origin_request_policy_config.headers_config.header_behavior == 'whitelist' | ||
- update_result.origin_request_policy.origin_request_policy_config.cookies_config.cookie_behavior == 'whitelist' | ||
|
||
- name: Ensure policy is deleted | ||
cloudfront_origin_request_policy: | ||
name: "{{ resource_prefix }}-my-origin-request-policy" | ||
comment: Created by Ansible test | ||
state: absent | ||
register: delete_result | ||
|
||
- name: Assert deletion without errors | ||
assert: | ||
that: | ||
- delete_result is changed | ||
- delete_result is not failed | ||
- delete_result.origin_request_policy is undefined | ||
|
||
always: | ||
|
||
- name: Ensure policy is deleted | ||
cloudfront_origin_request_policy: | ||
name: "{{ resource_prefix }}-my-origin-request-policy" | ||
state: absent | ||
ignore_errors: true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also please add some tests for check_mode and idempotency?