From b8f4c350ec10f4d750ebf95617d788fdcc8d648e Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 10 Feb 2021 12:32:15 +0100 Subject: [PATCH] Move tests to using module_defaults (#368) * Bulk migration to module_defaults * Tests for missing creds/region * Move dms_identifier and dms_sg_identifier into defaults This commit was initially merged in https://github.com/ansible-collections/community.aws See: https://github.com/ansible-collections/community.aws/commit/365b6ef9a7a5e78e1bcf0d190ab66957bed5e3dd --- .../rds_instance/tasks/credential_tests.yml | 10 ++++++ .../targets/rds_instance/tasks/main.yml | 12 +++++-- .../rds_instance/tasks/test_aurora.yml | 18 ----------- .../rds_instance/tasks/test_bad_options.yml | 10 ------ .../rds_instance/tasks/test_encryption.yml | 11 ------- .../tasks/test_final_snapshot.yml | 14 --------- .../rds_instance/tasks/test_modification.yml | 19 ------------ .../tasks/test_processor_features.yml | 15 --------- .../rds_instance/tasks/test_read_replica.yml | 17 ---------- .../tasks/test_restore_instance.yml | 15 --------- .../rds_instance/tasks/test_snapshot.yml | 13 -------- .../rds_instance/tasks/test_states.yml | 31 ------------------- .../targets/rds_instance/tasks/test_tags.yml | 24 -------------- .../tasks/test_vpc_security_groups.yml | 19 ------------ 14 files changed, 20 insertions(+), 208 deletions(-) diff --git a/tests/integration/targets/rds_instance/tasks/credential_tests.yml b/tests/integration/targets/rds_instance/tasks/credential_tests.yml index 1aa1c3a23da..36b5a96170c 100644 --- a/tests/integration/targets/rds_instance/tasks/credential_tests.yml +++ b/tests/integration/targets/rds_instance/tasks/credential_tests.yml @@ -2,6 +2,10 @@ - name: test without credentials rds_instance: db_instance_identifier: test-rds-instance + region: '{{ omit }}' + aws_access_key: '{{ omit }}' + aws_secret_key: '{{ omit }}' + security_token: '{{ omit }}' register: result ignore_errors: yes @@ -14,6 +18,9 @@ rds_instance: db_instance_identifier: test-rds-instance region: us-east-1 + aws_access_key: '{{ omit }}' + aws_secret_key: '{{ omit }}' + security_token: '{{ omit }}' register: result ignore_errors: yes @@ -27,6 +34,9 @@ db_instance_identifier: test-rds-instance region: us-east-1 profile: doesnotexist + aws_access_key: '{{ omit }}' + aws_secret_key: '{{ omit }}' + security_token: '{{ omit }}' register: result ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/main.yml b/tests/integration/targets/rds_instance/tasks/main.yml index bb368c47d05..e56dc896478 100644 --- a/tests/integration/targets/rds_instance/tasks/main.yml +++ b/tests/integration/targets/rds_instance/tasks/main.yml @@ -1,6 +1,14 @@ --- -- block: - +- name: 'rds_instance 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: - include: ./credential_tests.yml tags: credentials - include: ./test_states.yml diff --git a/tests/integration/targets/rds_instance/tasks/test_aurora.yml b/tests/integration/targets/rds_instance/tasks/test_aurora.yml index 14d28b248d7..c3a880d6bb1 100644 --- a/tests/integration/targets/rds_instance/tasks/test_aurora.yml +++ b/tests/integration/targets/rds_instance/tasks/test_aurora.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -29,7 +20,6 @@ cluster_id: "{{ cluster_id }}" username: "{{ username }}" password: "{{ password }}" - <<: *aws_connection_info - name: Create an Aurora instance rds_instance: @@ -40,7 +30,6 @@ db_instance_class: "{{ aurora_db_instance_class }}" tags: CreatedBy: rds_instance integration tests - <<: *aws_connection_info register: result - assert: @@ -55,7 +44,6 @@ state: present tags: Test: rds_instance - <<: *aws_connection_info register: result - assert: @@ -68,7 +56,6 @@ rds_instance: id: "{{ instance_id }}" state: present - <<: *aws_connection_info register: result - assert: @@ -82,7 +69,6 @@ password: "{{ password }}" force_update_password: True apply_immediately: True - <<: *aws_connection_info register: result ignore_errors: yes @@ -97,7 +83,6 @@ id: "{{ instance_id }}" state: present port: 1150 - <<: *aws_connection_info register: result ignore_errors: yes @@ -114,7 +99,6 @@ purge_tags: False new_id: "{{ modified_instance_id }}" apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -129,7 +113,6 @@ id: "{{ item }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info loop: - "{{ instance_id }}" - "{{ modified_instance_id }}" @@ -140,5 +123,4 @@ cluster_id: "{{ cluster_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/test_bad_options.yml b/tests/integration/targets/rds_instance/tasks/test_bad_options.yml index 21de862d227..9fd2f4fa6e4 100644 --- a/tests/integration/targets/rds_instance/tasks/test_bad_options.yml +++ b/tests/integration/targets/rds_instance/tasks/test_bad_options.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -31,7 +22,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result ignore_errors: True diff --git a/tests/integration/targets/rds_instance/tasks/test_encryption.yml b/tests/integration/targets/rds_instance/tasks/test_encryption.yml index dc9a8d96468..6c3e81494e5 100644 --- a/tests/integration/targets/rds_instance/tasks/test_encryption.yml +++ b/tests/integration/targets/rds_instance/tasks/test_encryption.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -32,7 +23,6 @@ db_instance_class: "{{ storage_encrypted_db_instance_class }}" allocated_storage: "{{ allocated_storage }}" storage_encrypted: True - <<: *aws_connection_info register: result - assert: @@ -49,5 +39,4 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result diff --git a/tests/integration/targets/rds_instance/tasks/test_final_snapshot.yml b/tests/integration/targets/rds_instance/tasks/test_final_snapshot.yml index bbada4207c4..9ad56360932 100644 --- a/tests/integration/targets/rds_instance/tasks/test_final_snapshot.yml +++ b/tests/integration/targets/rds_instance/tasks/test_final_snapshot.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -31,7 +22,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result - name: Delete the DB instance @@ -39,7 +29,6 @@ id: "{{ instance_id }}" state: absent final_snapshot_identifier: "{{ instance_id }}" - <<: *aws_connection_info register: result - assert: @@ -50,7 +39,6 @@ - name: Check that snapshot exists rds_snapshot_info: db_snapshot_identifier: "{{ instance_id }}" - <<: *aws_connection_info register: result - assert: @@ -63,7 +51,6 @@ rds_snapshot: db_snapshot_identifier: "{{ instance_id }}" state: absent - <<: *aws_connection_info ignore_errors: yes - name: Remove the DB instance @@ -71,5 +58,4 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/test_modification.yml b/tests/integration/targets/rds_instance/tasks/test_modification.yml index ff874447de3..4c1d28e7ec8 100644 --- a/tests/integration/targets/rds_instance/tasks/test_modification.yml +++ b/tests/integration/targets/rds_instance/tasks/test_modification.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -32,7 +23,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result - assert: @@ -46,7 +36,6 @@ state: present new_id: "{{ modified_instance_id }}" apply_immediately: False - <<: *aws_connection_info register: result - assert: @@ -60,7 +49,6 @@ state: present new_id: "{{ modified_instance_id }}" apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -74,7 +62,6 @@ state: present new_id: '{{ instance_id }}' apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -89,7 +76,6 @@ password: '{{ password }}' force_update_password: True apply_immediately: True - <<: *aws_connection_info register: result check_mode: True @@ -104,7 +90,6 @@ password: '{{ password }}' force_update_password: True apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -129,7 +114,6 @@ port: 1150 max_allocated_storage: 100 apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -155,7 +139,6 @@ auto_minor_version_upgrade: false port: 1150 max_allocated_storage: 100 - <<: *aws_connection_info register: result retries: 30 delay: 10 @@ -175,7 +158,6 @@ id: '{{ instance_id }}' state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -190,6 +172,5 @@ id: '{{ item }}' state: absent skip_final_snapshot: True - <<: *aws_connection_info loop: ['{{ instance_id }}', '{{ modified_instance_id }}'] ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/test_processor_features.yml b/tests/integration/targets/rds_instance/tasks/test_processor_features.yml index 2fb3d8951c6..78dd44be4f0 100644 --- a/tests/integration/targets/rds_instance/tasks/test_processor_features.yml +++ b/tests/integration/targets/rds_instance/tasks/test_processor_features.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -33,7 +24,6 @@ allocated_storage: "{{ allocated_storage }}" storage_encrypted: True processor_features: "{{ processor_features }}" - <<: *aws_connection_info register: result - assert: @@ -54,7 +44,6 @@ storage_encrypted: True processor_features: "{{ modified_processor_features }}" apply_immediately: true - <<: *aws_connection_info register: result check_mode: True @@ -74,7 +63,6 @@ storage_encrypted: True processor_features: "{{ modified_processor_features }}" apply_immediately: true - <<: *aws_connection_info register: result - assert: @@ -89,7 +77,6 @@ state: present processor_features: {} apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -102,7 +89,6 @@ state: present processor_features: {} apply_immediately: True - <<: *aws_connection_info register: result - assert: @@ -118,7 +104,6 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: diff --git a/tests/integration/targets/rds_instance/tasks/test_read_replica.yml b/tests/integration/targets/rds_instance/tasks/test_read_replica.yml index 3ed091b3dc8..ea87178e2f8 100644 --- a/tests/integration/targets/rds_instance/tasks/test_read_replica.yml +++ b/tests/integration/targets/rds_instance/tasks/test_read_replica.yml @@ -6,21 +6,12 @@ region_src: "{{ aws_region }}" region_dest: "{{ aws_region }}" - - 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 }}" - no_log: yes - - name: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True region: "{{ region_src }}" - <<: *aws_connection_info register: result - assert: @@ -42,7 +33,6 @@ tags: Name: "{{ instance_id }}" Created_by: Ansible rds_instance tests - <<: *aws_connection_info register: source_db - assert: @@ -65,7 +55,6 @@ tags: Name: "{{ instance_id }}" Created_by: Ansible rds_instance tests - <<: *aws_connection_info register: result - assert: @@ -90,7 +79,6 @@ tags: Name: "{{ instance_id }}" Created_by: Ansible rds_instance tests - <<: *aws_connection_info register: result - assert: @@ -112,7 +100,6 @@ tags: Name: "{{ instance_id }}" Created_by: Ansible rds_instance tests - <<: *aws_connection_info register: result - name: Promote the read replica @@ -121,7 +108,6 @@ state: present read_replica: False region: "{{ region_dest }}" - <<: *aws_connection_info register: result - assert: @@ -134,7 +120,6 @@ state: present read_replica: False region: "{{ region_dest }}" - <<: *aws_connection_info register: result - assert: @@ -149,7 +134,6 @@ state: absent skip_final_snapshot: True region: "{{ region_src }}" - <<: *aws_connection_info ignore_errors: yes - name: Remove the DB replica @@ -158,5 +142,4 @@ state: absent skip_final_snapshot: True region: "{{ region_dest }}" - <<: *aws_connection_info ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/test_restore_instance.yml b/tests/integration/targets/rds_instance/tasks/test_restore_instance.yml index b40e487dd81..8ca114fbcee 100644 --- a/tests/integration/targets/rds_instance/tasks/test_restore_instance.yml +++ b/tests/integration/targets/rds_instance/tasks/test_restore_instance.yml @@ -1,21 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -33,7 +23,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: source_db - assert: @@ -53,7 +42,6 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" use_latest_restorable_time: True - <<: *aws_connection_info register: result - name: Test idempotence with a point in time replica @@ -68,7 +56,6 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" restore_time: "{{ result.latest_restorable_time }}" - <<: *aws_connection_info register: result - assert: @@ -82,7 +69,6 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info ignore_errors: yes @@ -91,5 +77,4 @@ id: "{{ instance_id }}-point-in-time" state: absent skip_final_snapshot: True - <<: *aws_connection_info ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/test_snapshot.yml b/tests/integration/targets/rds_instance/tasks/test_snapshot.yml index 7e88db43713..de4c3edcc10 100644 --- a/tests/integration/targets/rds_instance/tasks/test_snapshot.yml +++ b/tests/integration/targets/rds_instance/tasks/test_snapshot.yml @@ -1,18 +1,9 @@ --- - block: - - 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: Getting shared snapshots rds_snapshot_info: snapshot_type: "shared" - <<: *aws_connection_info register: result - assert: @@ -26,7 +17,6 @@ db_instance_identifier: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -46,7 +36,6 @@ tags: Name: "{{ instance_id }}" Created_by: Ansible rds_instance tests - <<: *aws_connection_info register: result - assert: @@ -61,7 +50,6 @@ rds_snapshot_info: db_instance_identifier: "{{ instance_id }}" snapshot_type: "public" - <<: *aws_connection_info register: result - assert: @@ -75,7 +63,6 @@ db_instance_identifier: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: diff --git a/tests/integration/targets/rds_instance/tasks/test_states.yml b/tests/integration/targets/rds_instance/tasks/test_states.yml index f55ffe70ce2..7b16f81a183 100644 --- a/tests/integration/targets/rds_instance/tasks/test_states.yml +++ b/tests/integration/targets/rds_instance/tasks/test_states.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -31,7 +22,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result check_mode: yes @@ -48,7 +38,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result - assert: @@ -65,7 +54,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result - assert: @@ -77,7 +65,6 @@ rds_instance: id: '{{ instance_id }}' state: present - <<: *aws_connection_info register: result - assert: @@ -89,7 +76,6 @@ rds_instance: id: '{{ instance_id }}' state: stopped - <<: *aws_connection_info register: result check_mode: yes @@ -101,7 +87,6 @@ rds_instance: id: '{{ instance_id }}' state: stopped - <<: *aws_connection_info register: result - assert: @@ -112,7 +97,6 @@ rds_instance: id: '{{ instance_id }}' state: stopped - <<: *aws_connection_info register: result check_mode: yes @@ -124,7 +108,6 @@ rds_instance: id: '{{ instance_id }}' state: stopped - <<: *aws_connection_info register: result - assert: @@ -135,7 +118,6 @@ rds_instance: id: '{{ instance_id }}' state: rebooted - <<: *aws_connection_info register: result check_mode: yes @@ -147,7 +129,6 @@ rds_instance: id: '{{ instance_id }}' state: rebooted - <<: *aws_connection_info register: result - assert: @@ -158,7 +139,6 @@ rds_instance: id: '{{ instance_id }}' state: started - <<: *aws_connection_info register: result check_mode: yes @@ -170,13 +150,11 @@ rds_instance: id: '{{ instance_id }}' state: stopped - <<: *aws_connection_info - name: Start the instance rds_instance: id: '{{ instance_id }}' state: started - <<: *aws_connection_info register: result - assert: @@ -189,14 +167,12 @@ db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' state: present wait: yes - <<: *aws_connection_info - name: take a snapshot - idempotence rds_snapshot: db_instance_identifier: '{{ instance_id }}' db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' state: present - <<: *aws_connection_info register: result - assert: @@ -206,7 +182,6 @@ - name: check snapshot is ok rds_snapshot_info: db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' - <<: *aws_connection_info register: result - assert: @@ -217,7 +192,6 @@ rds_snapshot: db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' state: absent - <<: *aws_connection_info register: result - assert: @@ -229,7 +203,6 @@ db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' state: absent wait: yes - <<: *aws_connection_info register: result - assert: @@ -241,7 +214,6 @@ db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' state: absent wait: yes - <<: *aws_connection_info register: result - assert: @@ -251,7 +223,6 @@ - name: check snapshot is removed rds_snapshot_info: db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' - <<: *aws_connection_info register: result - assert: @@ -265,7 +236,6 @@ db_snapshot_identifier: '{{ resource_prefix }}-test-snapshot' state: absent wait: yes - <<: *aws_connection_info ignore_errors: yes - name: Remove DB instance @@ -273,5 +243,4 @@ id: '{{ instance_id }}' state: absent skip_final_snapshot: True - <<: *aws_connection_info ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/tasks/test_tags.yml b/tests/integration/targets/rds_instance/tasks/test_tags.yml index f5003ad7a93..353daec1f31 100644 --- a/tests/integration/targets/rds_instance/tasks/test_tags.yml +++ b/tests/integration/targets/rds_instance/tasks/test_tags.yml @@ -1,20 +1,11 @@ --- - block: - - 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: Ensure the resource doesn't exist rds_instance: db_instance_identifier: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -34,7 +25,6 @@ tags: Name: "{{ instance_id }}" Created_by: Ansible rds_instance tests - <<: *aws_connection_info register: result - assert: @@ -54,7 +44,6 @@ password: "{{ password }}" db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" - <<: *aws_connection_info register: result - assert: @@ -73,7 +62,6 @@ allocated_storage: "{{ allocated_storage }}" tags: {} purge_tags: False - <<: *aws_connection_info register: result - assert: @@ -89,7 +77,6 @@ Name: "{{ instance_id }}-new" Created_by: Ansible rds_instance tests purge_tags: True - <<: *aws_connection_info register: result - assert: @@ -108,7 +95,6 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" tags: {} - <<: *aws_connection_info register: result - assert: @@ -122,7 +108,6 @@ db_snapshot_identifier: "{{ resource_prefix }}-test-tags" state: present wait: yes - <<: *aws_connection_info register: result - assert: @@ -138,7 +123,6 @@ tags: one: hello two: world - <<: *aws_connection_info register: result - assert: @@ -154,7 +138,6 @@ tags: one: hello two: world - <<: *aws_connection_info register: result - assert: @@ -171,7 +154,6 @@ one: hello three: another purge_tags: False - <<: *aws_connection_info register: result - assert: @@ -187,7 +169,6 @@ tags: one: hello three: another - <<: *aws_connection_info register: result - assert: @@ -203,7 +184,6 @@ tags: one: hello three: another - <<: *aws_connection_info register: result - assert: @@ -217,7 +197,6 @@ db_snapshot_identifier: "{{ resource_prefix }}-test-tags" state: absent wait: yes - <<: *aws_connection_info register: result - assert: @@ -234,7 +213,6 @@ three: another purge_tags: yes wait: yes - <<: *aws_connection_info register: result - assert: @@ -249,7 +227,6 @@ db_instance_identifier: "{{ instance_id }}" db_snapshot_identifier: "{{ resource_prefix }}-test-tags" state: absent - <<: *aws_connection_info ignore_errors: yes - name: Ensure the resource doesn't exist @@ -257,7 +234,6 @@ db_instance_identifier: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: diff --git a/tests/integration/targets/rds_instance/tasks/test_vpc_security_groups.yml b/tests/integration/targets/rds_instance/tasks/test_vpc_security_groups.yml index 53c7e9d07ea..f481b71fd72 100644 --- a/tests/integration/targets/rds_instance/tasks/test_vpc_security_groups.yml +++ b/tests/integration/targets/rds_instance/tasks/test_vpc_security_groups.yml @@ -3,14 +3,6 @@ collections: - amazon.aws block: - - 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: create a VPC ec2_vpc_net: @@ -20,7 +12,6 @@ tags: Name: "{{ resource_prefix }}-vpc" Description: "created by rds_instance integration tests" - <<: *aws_connection_info register: vpc_result - name: create subnets @@ -32,7 +23,6 @@ Name: "{{ resource_prefix }}-subnet" Description: "created by rds_instance integration tests" state: present - <<: *aws_connection_info register: subnets_result loop: - {"cidr": "10.122.122.128/28", "zone": "{{ aws_region }}a"} @@ -45,7 +35,6 @@ name: "{{ item }}" description: "created by rds_instance integration tests" state: present - <<: *aws_connection_info register: sgs_result loop: - "{{ resource_prefix }}-sg-1" @@ -59,7 +48,6 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result - assert: @@ -79,7 +67,6 @@ vpc_security_group_ids: - "{{ sgs_result.results.0.group_id }}" - "{{ sgs_result.results.1.group_id }}" - <<: *aws_connection_info register: result - assert: @@ -93,7 +80,6 @@ state: present vpc_security_group_ids: - "{{ sgs_result.results.2.group_id }}" - <<: *aws_connection_info register: result - assert: @@ -107,7 +93,6 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result ignore_errors: yes @@ -116,7 +101,6 @@ name: "{{ item }}" description: "created by rds_instance integration tests" state: absent - <<: *aws_connection_info register: sgs_result loop: - "{{ resource_prefix }}-sg-1" @@ -132,7 +116,6 @@ Name: "{{ resource_prefix }}-subnet" Description: "created by rds_instance integration tests" state: absent - <<: *aws_connection_info register: subnets ignore_errors: yes retries: 30 @@ -152,7 +135,6 @@ tags: Name: "{{ resource_prefix }}-vpc" Description: "created by rds_instance integration tests" - <<: *aws_connection_info register: vpc_result ignore_errors: yes retries: 30 @@ -164,6 +146,5 @@ id: "{{ instance_id }}" state: absent skip_final_snapshot: True - <<: *aws_connection_info register: result ignore_errors: yes