diff --git a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml index b70db393023..9c5f3947952 100644 --- a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml +++ b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml @@ -1,24 +1,25 @@ --- -# tasks file for test_ec2_transit_gateway +- name: 'ec2_transit_gateway integration tests' + collections: + - amazon.aws + 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: generate unique value for testing + set_fact: + tgw_description: "{{ resource_prefix }}-tgw" -- name: set up aws connection info - set_fact: - aws_connection_info: &aws_connection_info - aws_access_key: "{{ aws_access_key }}" - aws_secret_key: "{{ aws_secret_key }}" - security_token: "{{ security_token }}" - region: "{{ aws_region }}" - no_log: yes - -- name: generate unique value for testing - set_fact: - tgw_description: "{{ resource_prefix }}-tgw" - -- block: - name: test create transit gateway without permissions ec2_transit_gateway: + aws_access_key: '{{ omit }}' + aws_secret_key: '{{ omit }}' + security_token: '{{ omit }}' description: "{{ tgw_description }}" - region: "{{ aws_region }}" register: result ignore_errors: yes @@ -31,6 +32,7 @@ - name: test create transit gateway without region ec2_transit_gateway: description: "{{ tgw_description }}" + region: '{{ omit }}' register: result ignore_errors: yes @@ -43,7 +45,6 @@ - name: test create transit gateway without tags ec2_transit_gateway: description: "{{ tgw_description }}" - <<: *aws_connection_info register: create_result - name: assert changed is True assert: @@ -55,7 +56,6 @@ description: "{{ tgw_description }}" tags: Name: Ansible Test TGW - <<: *aws_connection_info register: result - name: assert changed is True assert: @@ -70,7 +70,6 @@ purge_tags: False tags: status: ok to delete - <<: *aws_connection_info register: result - name: assert changed is True and have 2 tags assert: @@ -85,7 +84,6 @@ purge_tags: True tags: status: ok to delete - <<: *aws_connection_info register: result - name: assert changed is True and TGW tag is absent assert: @@ -100,7 +98,6 @@ purge_tags: True tags: status: ok to delete - <<: *aws_connection_info register: result - name: assert changed is False assert: @@ -110,7 +107,6 @@ # ==== Combine ec2_transit_gateway_info ====================== - name: test success with no parameters ec2_transit_gateway_info: - <<: *aws_connection_info register: result - name: assert success with no parameters assert: @@ -122,7 +118,6 @@ ec2_transit_gateway_info: filters: transit-gateway-id: "{{ create_result.transit_gateway.transit_gateway_id }}" - <<: *aws_connection_info register: result - name: assert success with transit_gateway_id filter assert: @@ -134,7 +129,6 @@ ec2_transit_gateway_info: filters: transit-gateway-id: tgw-00000011111111122 - <<: *aws_connection_info register: result - name: assert success with transit_gateway_id filter assert: @@ -145,7 +139,6 @@ - name: test NotFound exception caught and returned empty result set ec2_transit_gateway_info: transit_gateway_id: tgw-00000011111111122 - <<: *aws_connection_info register: result - name: assert success with transit_gateway_id filter assert: @@ -158,7 +151,6 @@ filters: options.dns-support: enable options.vpn-ecmp-support: enable - <<: *aws_connection_info register: result - name: assert success with transit_gateway_id filter assert: @@ -171,5 +163,4 @@ ec2_transit_gateway: description: "{{ tgw_description }}" state: absent - <<: *aws_connection_info ignore_errors: yes