This repository was archived by the owner on May 13, 2021. It is now read-only.
Add support for reconciliation of router configs #18
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.
Currently there is no way to cleanly reconfigure/repair the tunnels in a CSR that has been replaced (unless you have an off-system backup of the configuration). While looking at options for automating this, I also picked up a couple of related limitations:
This pull fixes these and adds support for a reconciliation event running on a regular schedule (every 6 hours).
New features:
During VGW processing, orphan VPN configs are identified and changed to delete status. This only runs if the environment is stable (no other VGW processing completed that cycle), and only runs if the lambda is in the same account as the CSRs (will have visibility into all VPN connections).
During S3 events, VPN configs with delete status are removed as normal, but the S3 config is then disabled to prevent further processing.
During scheduled events, all active VPN configs are evaluated
3.1. Existing tunnels will be updated/repaired as necessary. Warnings will be issued for any duplicate tunnels, but only the lower tunnels will be updated (these are the ones that will have valid configs)
3.2. New tunnels will be created if necessary
3.3. Tunnels marked for delete will be fully cleaned up (including any duplicates), then those S3 configs are disabled
It did require a refactor of some existing code to avoid duplication, and a change in behavior for the tunnel ID parameters being passed around (using lists of IDs rather than assuming a base+1).
We use Terraform for our deployments, but the necessary Cloudformation changes are included.