[PR #1659/26d7243 backport][stable-8] Fix ec2_instance 'state' processing when exact_count is used #2276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a MANUAL backport of PR #1659 as merged into main (26d7243).
SUMMARY
Fixes (ie adds) 'state' processing for ec2_instance when 'exact_count' is used rather than 'instance_ids'
Note this only has effect when the exact_count is the same as the number of already existing, matching instances.
In other words, it (still) has no effect when instances are either added or terminated as a result of exact_count. This is probably OK, as those other cases already have set target states (ie running or terminated respectively).
But for the cases of managing the state of an existing group of instances, this adds that ability.
ISSUE TYPE
COMPONENT NAME
ec2_instance
ADDITIONAL INFORMATION
Currently, given an ec2_instance call where exact_count == existing instance count, any specification of 'state' has no effect.