From 129e998276177a8334e07d5e952c464b97611ad2 Mon Sep 17 00:00:00 2001 From: Jill R <4121322+jillr@users.noreply.github.com> Date: Mon, 19 Aug 2019 09:22:38 -0700 Subject: [PATCH] EC2: Don't count instances in 'shutting-down' as running (#60709) state: shutting-down is a precursor to terminated and should be treated as such for exact_count. Fixes #55955 --- lib/ansible/modules/cloud/amazon/ec2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index 918918b5871..45a81e0cd74 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -600,7 +600,7 @@ def find_running_instances_by_count_tag(module, ec2, vpc, count_tag, zone=None): for res in reservations: if hasattr(res, 'instances'): for inst in res.instances: - if inst.state == 'terminated': + if inst.state == 'terminated' or inst.state == 'shutting-down': continue instances.append(inst)