EC2 module errors out since it incorrectly includes terminated instances #146
Labels
affects_2.10
bug
This issue/PR relates to a bug
module
module
needs_triage
plugins
plugin (any type)
python3
SUMMARY
Given this task:
If there are existing (recently) terminated ec2 instances matching that tag, Ansible will error out with this message:
"Unable to change state for instance i-03bb1408d136a9a4b, error: EC2ResponseError: 400 Bad Request\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response><Errors><Error><Code>IncorrectInstanceState</Code><Message>This instance 'i-03bb1408d136a9a4b' is not in a state from which it can be stopped.</Message></Error></Errors><RequestID>d35eac01-6fa2-4c62-9763-3a5a08651a5c</RequestID></Response>"}
This seems to happen because Ansible considers all instances matching the
instance_tags
, including terminated instances. The correct behaviour would be to only consider non-terminated instances for all evaluationsISSUE TYPE
COMPONENT NAME
ec2
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Ubuntu 20.04
STEPS TO REPRODUCE
See description above
EXPECTED RESULTS
Ansible should disregard terminated instances and not error out
ACTUAL RESULTS
See description
The text was updated successfully, but these errors were encountered: