Skip to content

Commit

Permalink
kms_key: integration test - Fetch updated state after pausing (#2414)
Browse files Browse the repository at this point in the history
SUMMARY
Deletion state test forgot to re-fetch state after pause.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
kms_key
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
  • Loading branch information
tremble authored Dec 5, 2024
1 parent e178256 commit 400fbe3
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,21 @@
ansible.builtin.wait_for:
timeout: 45

- name: Fetch updated state of key
amazon.aws.kms_key_info:
alias: "{{ kms_key_alias }}"
pending_deletion: True
register: deleted_kms

- name: Assert that state is pending deletion
vars:
deleted_key: '{{ deleted_kms.kms_keys[0] }}'
now_time: '{{ lookup("pipe", "date -u +%Y-%m-%d\ %H:%M:%S") }}'
deletion_time: '{{ delete_kms.deletion_date[:19] | to_datetime("%Y-%m-%dT%H:%M:%S") }}'
deletion_time: '{{ deleted_key.deletion_date[:19] | to_datetime("%Y-%m-%dT%H:%M:%S") }}'
ansible.builtin.assert:
that:
- delete_kms.key_state == "PendingDeletion"
- delete_kms.changed
- deleted_key.key_state == "PendingDeletion"
# Times won't be perfect, allow a 24 hour window
- (( deletion_time | to_datetime ) - ( now_time | to_datetime )).days <= 7
- (( deletion_time | to_datetime ) - ( now_time | to_datetime )).days >= 6
Expand Down

0 comments on commit 400fbe3

Please sign in to comment.