Skip to content

Commit

Permalink
cloudfront_distribution: fix restrictions (ansible#37476)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvey authored and willthames committed Apr 4, 2018
1 parent 68f81a6 commit 63a8ae9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ def validate_restrictions(self, config, restrictions, purge_restrictions=False):
rest not in geo_restriction_items])
valid_restrictions = ansible_list_to_cloudfront_list(geo_restriction_items)
valid_restrictions['restriction_type'] = geo_restriction.get('restriction_type')
return valid_restrictions
return {'geo_restriction': valid_restrictions}
except Exception as e:
self.module.fail_json_aws(e, msg="Error validating restrictions")

Expand Down
17 changes: 17 additions & 0 deletions test/integration/targets/cloudfront_distribution/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@
that:
- update_origin_http_port.changed

- name: update restrictions
cloudfront_distribution:
alias: "{{ cloudfront_alias }}"
restrictions:
geo_restriction:
restriction_type: "whitelist"
items:
- "US"
state: present
<<: *aws_connection_info
register: update_restrictions

- name: ensure restrictions was updated
assert:
that:
- update_restrictions.changed

- name: set a random comment
set_fact:
comment: "{{'ABCDEFabcdef123456'|shuffle|join }}"
Expand Down

0 comments on commit 63a8ae9

Please sign in to comment.