diff --git a/roles/aws/aws_backup_validation/tasks/testing_resources.yml b/roles/aws/aws_backup_validation/tasks/testing_resources.yml index 2b36bcc96..7dfcfe66f 100644 --- a/roles/aws/aws_backup_validation/tasks/testing_resources.yml +++ b/roles/aws/aws_backup_validation/tasks/testing_resources.yml @@ -65,11 +65,29 @@ _instance_type_restore: "{{ _instance_type[backup.resource_type] }}" when: backup.resource_type != 'file-system' +- name: Print previous variable + ansible.builtin.debug: + var: _instance_type + +- name: Print previous variable + ansible.builtin.debug: + var: _instance_type_restore + - name: Create restore testing query file. ansible.builtin.template: src: restore_testing.j2 dest: /tmp/restore_testing.json register: _restore_testing_query + when: _instance_type_restore is defined + +- name: Check if protected reource exist + ansible.builtin.command: > + aws backup list-protected-resources --query "Results[?ResourceArn=='{{ _resource_arn }}']" --region {{ _aws_region }} + register: _protected_res + +- name: Print previous variable + ansible.builtin.debug: + var: _protected_res - name: Check if protected reource exist ansible.builtin.command: > @@ -83,4 +101,4 @@ - name: Assign EC2 resource to AWS restore testing plan. ansible.builtin.command: > aws backup create-restore-testing-selection --cli-input-json file:///tmp/restore_testing.json --region {{ _aws_region }} - when: _testing_plan_info.stdout != "null" and _testing_selection_exists.stdout | length == 0 and _protected_res.stdout | length != 0 + when: _instance_type_restore is defined and _testing_plan_info.stdout != "null" and _testing_selection_exists.stdout | length == 0 and _protected_res.stdout | length != 0