aws:Allow reassignment of EIP instances appropriately #7686
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.
Recreated from PR #6682 because I fubared the merge and it was easier just to cherry-pick
fixes #6076
As atward described, when using the instance_id attribute for the association, in the background AWS is also assigning the network_interface_id. The current way of checking would essentially eliminate any possibility of reallocating the route to a new instance id due to the numTargets check always returning 2 in that case and fast failing.
Update order of precedence to ensure that allowedTargets is evaluated so that instance_id comes after network_interface_id to allow for check
If there are multiple but they are instance_id and network_interface_id is the other let AWS handle the network_interface_id
NOTE: One thing I would have liked to add a test for but had a family emergency come up is tainting the original instance and reapplying. I did not see any direct example of doing this and was considering simply standing up 2 instances in the test and running a re-apply to associate the 2nd instance. If I get a chance before this is merged I will try and do so however I do not have cycles immediately.