From 666bacdceeb3193c53b85dc48f30adca361c8bcf Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Fri, 10 Nov 2023 09:43:14 +0100 Subject: [PATCH] Use retries to wait for SG updates to complete --- .../ec2_instance_state_config_updates/tasks/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/ec2_instance_state_config_updates/tasks/main.yml b/tests/integration/targets/ec2_instance_state_config_updates/tasks/main.yml index 7dbdc7150ff..ae4cee18aa0 100644 --- a/tests/integration/targets/ec2_instance_state_config_updates/tasks/main.yml +++ b/tests/integration/targets/ec2_instance_state_config_updates/tasks/main.yml @@ -57,10 +57,16 @@ - '"instances" in change_params_result' - '"instance_ids" in change_params_result' - '"changes" in change_params_result' - - change_params_result.instances[0].security_groups[0].group_id == "{{ sg2.group_id }}" - change_params_result.changes[0].DisableApiTermination.Value == True - change_params_result.changes[1].Groups[0] == "{{ sg2.group_id }}" + - name: Verify security groups were updated (can take time to complete) + amazon.aws.ec2_instance_info: + instance_ids: "{{ change_params_result.instance_ids }}" + register: changed_sg_info + retries: 5 + until: + - changed_sg_info.instances[0].security_groups[0].group_id == "{{ sg2.group_id }}" - name: Change instance state from running to stopped, and change sg and termination protection amazon.aws.ec2_instance: