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
This commit is contained in:
Jill R 2019-08-19 09:22:38 -07:00 committed by GitHub
parent 2f05953b52
commit 129e998276
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -600,7 +600,7 @@ def find_running_instances_by_count_tag(module, ec2, vpc, count_tag, zone=None):
for res in reservations: for res in reservations:
if hasattr(res, 'instances'): if hasattr(res, 'instances'):
for inst in res.instances: for inst in res.instances:
if inst.state == 'terminated': if inst.state == 'terminated' or inst.state == 'shutting-down':
continue continue
instances.append(inst) instances.append(inst)