Allow NAT instance launch before terminating #167
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 change makes it possible to allow new NAT instances to launch before terminating old ones by setting the ASG instance maintenance policy.
With
allow_launch_before_terminatingenabled the routes will only be replaced once (directly from old to new) when instances are refreshed. This behavior is also a prerequisite for syncing conntrack tables as mentioned in #67.As two instances will briefly run concurrently a spare Elastic IP is needed for the new instance to launch. I refactored the existing Elastic IP calculations, and added a validation for the existing
nat_instance_eip_idsvariable in the form of a precondition block. This does require Terraform v1.2 or later, which I think should be fine after more than three years.Depends on #169.