This repository has been archived by the owner on May 13, 2021. It is now read-only.
Add support for multiple HUB's (one HUB per region) #14
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.
The current poller script contains several race conditions in the use case where a hub is required in different regions. If the Transit VPC stack is created in multiple regions currently then it is not possible to control (for a given VPC/VGW) which hub in which region the VPN connection will be created for.
This pull request makes modifications to the poller script to remove these race conditions by extending the use of the value of
HUB_TAG
beyond the default "true" setting.With this PR the HUB_TAG value can now be:
us-east-1
,us-west-2
,ca-central-1
etcIf the the value of
HUB_TAG
is a AWS region then the poller function will ONLY operate on the found VGW is its tagged with the same AWS region that the lambda function is working on. This allows VGW's to be targeted towards specific hub's by the value of the tag.If the VGW is tagged with
HUB_TAG_VALUE
then the behavior of the lambda function is unchanged.The lambda function has been modified in the following ways
isValidRegion
added to determine if a given string is a valid AWS regionAWS_DEFAULT_REGION
)updateConfigXML
function to set "create" mode if value of HUB_TAG is a valid AWS regionTesting performed
true
on separate VGW's across multiple regions to confirm behavior unchanged in this use-case