From 4e7bdb61ce05b5009e74d1ff623c455e6279c149 Mon Sep 17 00:00:00 2001 From: Nicolas Boutet Date: Wed, 19 Oct 2022 07:56:20 +0300 Subject: [PATCH] Add tests --- .../cloudfront_distribution/tasks/main.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/integration/targets/cloudfront_distribution/tasks/main.yml b/tests/integration/targets/cloudfront_distribution/tasks/main.yml index fddaf502ceb..4d78928d504 100644 --- a/tests/integration/targets/cloudfront_distribution/tasks/main.yml +++ b/tests/integration/targets/cloudfront_distribution/tasks/main.yml @@ -146,6 +146,44 @@ - update_origin_origin_shield.origins.items[0].origin_shield.enabled - update_origin_origin_shield.origins.items[0].origin_shield.origin_shield_region == '{{ aws_region }}' + - name: enable origin Origin Shield again to test idempotency + cloudfront_distribution: + distribution_id: "{{ distribution_id }}" + origins: + - domain_name: "{{ cloudfront_hostname }}-origin.example.com" + custom_origin_config: + http_port: 8080 + origin_shield: + enabled: true + origin_shield_region: '{{ aws_region }}' + state: present + register: update_origin_origin_shield_idempotency + + - name: test idempotency for Origin Shield + assert: + that: + - not update_origin_origin_shield_idempotency.changed + - update_origin_origin_shield_idempotency.origins.items[0].origin_shield.enabled + - update_origin_origin_shield_idempotency.origins.items[0].origin_shield.origin_shield_region == '{{ aws_region }}' + + - name: disable origin Origin Shield + cloudfront_distribution: + distribution_id: "{{ distribution_id }}" + origins: + - domain_name: "{{ cloudfront_hostname }}-origin.example.com" + custom_origin_config: + http_port: 8080 + origin_shield: + enabled: false + state: present + register: update_origin_origin_shield_disable + + - name: ensure origin Origin Shield was disabled + assert: + that: + - update_origin_origin_shield_disable.changed + - not update_origin_origin_shield_disable.origins.items[0].origin_shield.enabled + - name: update restrictions cloudfront_distribution: distribution_id: "{{ distribution_id }}"