diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md
new file mode 100755
index 0000000..687d702
--- /dev/null
+++ b/.chglog/CHANGELOG.tpl.md
@@ -0,0 +1,111 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+
+{{ if .Versions -}}
+
+## [Unreleased]
+{{ if .Unreleased.CommitGroups -}}
+{{ range .Unreleased.CommitGroups -}}
+### {{ .Title }}
+{{ range .Commits -}}
+{{/* SKIPPING RULES - START */ -}}
+{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
+{{- if not (contains .Subject "[ci skip]") -}}
+{{- if not (contains .Subject "[skip ci]") -}}
+{{- if not (hasPrefix .Subject "Merge pull request ") -}}
+{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
+{{- /* SKIPPING RULES - END */ -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
+{{/* SKIPPING RULES - START */ -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{/* SKIPPING RULES - END */ -}}
+{{ end }}
+{{ end -}}
+{{ else }}
+{{ range .Unreleased.Commits -}}
+{{/* SKIPPING RULES - START */ -}}
+{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
+{{- if not (contains .Subject "[ci skip]") -}}
+{{- if not (contains .Subject "[skip ci]") -}}
+{{- if not (hasPrefix .Subject "Merge pull request ") -}}
+{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
+{{- /* SKIPPING RULES - END */ -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
+{{/* SKIPPING RULES - START */ -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{/* SKIPPING RULES - END */ -}}
+{{ end }}
+{{ end -}}
+{{ end -}}
+
+{{ range .Versions }}
+
+## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
+{{ if .CommitGroups -}}
+{{ range .CommitGroups -}}
+### {{ .Title }}
+{{ range .Commits -}}
+{{/* SKIPPING RULES - START */ -}}
+{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
+{{- if not (contains .Subject "[ci skip]") -}}
+{{- if not (contains .Subject "[skip ci]") -}}
+{{- if not (hasPrefix .Subject "Merge pull request ") -}}
+{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
+{{- /* SKIPPING RULES - END */ -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
+{{/* SKIPPING RULES - START */ -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{/* SKIPPING RULES - END */ -}}
+{{ end }}
+{{ end -}}
+{{ else }}
+{{ range .Commits -}}
+{{/* SKIPPING RULES - START */ -}}
+{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
+{{- if not (contains .Subject "[ci skip]") -}}
+{{- if not (contains .Subject "[skip ci]") -}}
+{{- if not (hasPrefix .Subject "Merge pull request ") -}}
+{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
+{{- /* SKIPPING RULES - END */ -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
+{{/* SKIPPING RULES - START */ -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+{{/* SKIPPING RULES - END */ -}}
+{{ end }}
+{{ end -}}
+
+{{- if .NoteGroups -}}
+{{ range .NoteGroups -}}
+### {{ .Title }}
+{{ range .Notes }}
+{{ .Body }}
+{{ end }}
+{{ end -}}
+{{ end -}}
+{{ end -}}
+
+{{- if .Versions }}
+[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
+{{ range .Versions -}}
+{{ if .Tag.Previous -}}
+[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
+{{ end -}}
+{{ end -}}
+{{ end -}}
diff --git a/.chglog/config.yml b/.chglog/config.yml
new file mode 100755
index 0000000..81e9d4f
--- /dev/null
+++ b/.chglog/config.yml
@@ -0,0 +1,13 @@
+style: github
+template: CHANGELOG.tpl.md
+info:
+ title: CHANGELOG
+ repository_url: https://github.com/binbashar/terraform-aws-natgw-notifications
+options:
+ header:
+ pattern: "^(.*)$"
+ pattern_maps:
+ - Subject
+ notes:
+ keywords:
+ - BREAKING CHANGE
diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..c6ba426
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,159 @@
+version: 2.1
+
+jobs:
+ #
+ # Test 1 & Test 2
+ #
+ test-static-code-and-linting:
+ machine:
+ image: ubuntu-1604:201903-01 # Ubuntu 16.04, docker 18.09.3, docker-compose 1.23.1
+
+ # This job has been blocked because Docker Layer Caching is not available on your plan.
+ # Should upgrade if necessary.
+ docker_layer_caching: false
+
+ steps:
+ - checkout
+
+ - run:
+ name: Context Info Cmds
+ command: pwd && ls -ltra && git branch
+
+ - run:
+ name: test1-terraform-format
+ command: make format-check
+
+ - run:
+ name: Install awscli
+ command: sudo pip install awscli
+
+ - run:
+ name: Configure awscli
+ command: |
+ # AWS defautl awscli profile
+ aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
+ aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
+ aws configure set region us-east-1
+ aws configure set output json
+
+ # AWS dev awscli profile
+ aws configure set role_arn arn:aws:iam::$AWS_ACCOUNT_ID_DEV:role/DeployMaster --profile $AWS_PROFILE_NAME
+ aws configure set source_profile default --profile $AWS_PROFILE_NAME
+ # moving credentials to specific project folder
+ mkdir --parents /home/circleci/.aws/bb
+ cp /home/circleci/.aws/credentials /home/circleci/.aws/bb/credentials
+ cp /home/circleci/.aws/config /home/circleci/.aws/bb/config
+
+ - run:
+ name: test2-terraform-linting
+ command: make tflint-deep
+
+ #
+ # Test 3
+ #
+ test-e2e-terratests:
+ machine:
+ image: ubuntu-1604:201903-01
+ docker_layer_caching: false
+
+ steps:
+ - checkout
+
+ - run:
+ name: Context Info Cmds
+ command: pwd && ls -ltra && git branch
+
+ - run:
+ name: Install awscli
+ command: sudo pip install awscli
+
+ - run:
+ name: Configure awscli
+ command: |
+ # AWS defautl awscli profile
+ aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
+ aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
+ aws configure set region us-east-1
+ aws configure set output json
+
+ # AWS dev awscli profile
+ aws configure set role_arn arn:aws:iam::$AWS_ACCOUNT_ID_DEV:role/DeployMaster --profile $AWS_PROFILE_NAME
+ aws configure set source_profile default --profile $AWS_PROFILE_NAME
+ # moving credentials to specific project folder
+ mkdir --parents /home/circleci/.aws/bb
+ cp /home/circleci/.aws/credentials /home/circleci/.aws/bb/credentials
+ cp /home/circleci/.aws/config /home/circleci/.aws/bb/config
+
+ - run:
+ name: Test AWS permissions
+ command: aws ec2 describe-instances --region us-east-1 --profile $AWS_PROFILE_NAME
+
+ - run:
+ name: test3-terratests-dep-init
+ command: make terratest-dep-init
+
+ - run:
+ name: test3-terratests-go-test
+ command: make terratest-go-test
+
+ #
+ # Release
+ #
+ release-version-with-changelog:
+ machine:
+ image: ubuntu-1604:201903-01
+ docker_layer_caching: false
+
+ environment:
+ VERSION_NUMBER: patch # opts: patch, minor or major.
+
+ steps:
+ - checkout
+
+ - run:
+ name: Context Info Cmds
+ command: pwd && ls -ltra && git branch
+
+ - run:
+ name: Release New Version
+ command: |
+ if git status | grep 'nothing to commit, working tree clean'; then
+ echo "==============================================================================================="
+ echo "release-$VERSION_NUMBER-with-changelog-circleci"
+ echo "==============================================================================================="
+ git config --global user.email "$GIT_USER_EMAIL"
+ git config --global user.name "$GIT_USER_NAME"
+ make -f Makefile.release release-$VERSION_NUMBER-with-changelog-circleci
+ else
+ echo "==============================================================================================="
+ echo "Changes in working directory pending to be pushed - please check 'git status' cmd output below "
+ echo "==============================================================================================="
+ echo "$(git status)"
+ echo "==============================================================================================="
+ fi
+
+#
+# Jobs workflow
+#
+workflows:
+ version: 2
+ test_and_release:
+ jobs:
+ - test-static-code-and-linting:
+ context: binbashar-org-global-context
+ filters:
+ branches:
+ ignore: # only branches matching the below regex filters will run
+ - master
+ - test-e2e-terratests:
+ context: binbashar-org-global-context
+ filters:
+ branches:
+ ignore: # only branches matching the below regex filters will run
+ - master
+ - release-version-with-changelog:
+ context: binbashar-org-global-context
+ filters:
+ branches:
+ only: # only branches matching the below regex filters will run
+ - master
diff --git a/.gitallowed b/.gitallowed
new file mode 100644
index 0000000..d674a0e
--- /dev/null
+++ b/.gitallowed
@@ -0,0 +1,4 @@
+# https://github.com/awslabs/git-secrets
+aws/cost-mgmt-budget-bb/examples/cloudwatch-billing-alert-to-new-sns/main.tf
+aws/cost-mgmt-budget-notif-bb/README.MD
+aws/cost-mgmt-budget-notif-bb/README.MD
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..ef8c756
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,5 @@
+# Use this file to define individuals or teams that are responsible for code in a repository.
+# Read more:
+
+* @binbashar/leverage-ref-architecture-aws-admin
+* @binbashar/leverage-ref-architecture-aws-dev
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..ce2c133
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,33 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: 'bug'
+assignees: ''
+
+---
+
+## Describe the Bug
+A clear and concise description of what the bug is.
+
+## Expected Behavior
+A clear and concise description of what you expected to happen.
+
+## Steps to Reproduce
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Run '....'
+3. Enter '....'
+4. See error
+
+## Screenshots
+If applicable, add screenshots or logs to help explain your problem.
+
+## Environment (please complete the following information):
+
+Anything that will help us triage the bug will help. Here are some ideas:
+ - OS: [e.g. Linux, OSX, WSL, etc]
+ - Version [e.g. 10.15]
+
+## Additional Context
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..d662eb2
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,8 @@
+blank_issues_enabled: false
+
+contact_links:
+
+ - name: DevOps Cloud Services Program
+ url: https://www.binbash.com.ar
+ about: |-
+ At Binbash Leverage, our focus is on creating reusable, high quality infrastructure code, such as our Reference AWS Cloud Solutions Architecture backed by our DevOps Automation Code Library.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..c2147ff
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,32 @@
+---
+name: Feature Request
+about: Suggest an idea for this project
+title: ''
+labels: 'feature request'
+assignees: ''
+
+---
+
+## Describe the Feature
+
+A clear and concise description of what the bug is.
+
+## Expected Behavior
+
+A clear and concise description of what you expected to happen.
+
+## Use Case
+
+Is your feature request related to a problem/challenge you are trying to solve? Please provide some additional context of why this feature or capability will be valuable.
+
+## Describe Ideal Solution
+
+A clear and concise description of what you want to happen. If you don't know, that's okay.
+
+## Alternatives Considered
+
+Explain what alternative solutions or features you've considered.
+
+## Additional Context
+
+Add any other context or screenshots about the feature request here.
diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md
new file mode 100644
index 0000000..e69de29
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..4b8f32d
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,13 @@
+## what
+* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
+* Use bullet points to be concise and to the point.
+
+## why
+* Provide the justifications for the changes (e.g. business case).
+* Describe why these changes were made (e.g. why do these commits fix the problem?)
+* Use bullet points to be concise and to the point.
+
+## references
+* Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
+* Use `closes #123`, if this PR closes a GitHub issue `#123`
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9220bac
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,96 @@
+# Hidden files #
+################
+.*
+#
+# Except
+#
+!*.env.example
+!*.circleci
+!*.dockeringnore
+!*.hosts
+!/.gitignore
+!/.chglog
+!/.gitallowed
+!/.github
+!*.gitkeep
+
+# SSH keys #
+############
+id_rsa
+id_dsa
+
+# OS generated files #
+######################
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+ehthumbs.db
+Thumbs.db
+
+# Packages #
+############
+# it's better to unpack these files and commit the raw source
+# git has its own built in compression methods
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.zip
+*.tar.gz
+
+#
+# Except
+#
+!lambda_function.*.zip
+!lambda_function.lambda_handler.zip
+!lambda_function.*.zip
+
+# Logs and databases #
+######################
+*.log
+*.sql
+*.sqlite
+*.out
+
+# IDE related files #
+#####################
+.classpath
+.project
+.settings
+.idea
+.metadata
+*.iml
+*.ipr
+.vscode
+/src
+/venv
+
+# Custom Project tools files #
+########################
+*.pyc
+*.pyo
+*.vault_pass
+*.pgpass
+*.vagrant
+
+# TF Project files #
+####################
+#
+# Compiled files
+#
+*.tfstate
+*.tfstate.backup
+#
+# Module directory
+#
+.terraform
+#
+# Terratest
+#
+tests/vendor/
+tests/Gopkg.*
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..5530abe
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2020 Binbashar Inc
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f5c9958
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,137 @@
+.PHONY: help
+SHELL := /bin/bash
+PROJECT_SHORT := bb
+
+LOCAL_OS_USER_ID := $(shell id -u)
+LOCAL_OS_GROUP_ID := $(shell id -g)
+LOCAL_OS_SSH_DIR := ~/.ssh
+LOCAL_OS_GIT_CONF_DIR := ~/.gitconfig
+LOCAL_OS_AWS_CONF_DIR := ~/.aws/${PROJECT_SHORT}
+
+# localhost aws-iam-profile
+#LOCAL_OS_AWS_PROFILE := bb-shared-deploymaster
+# ci aws-iam-profile
+LOCAL_OS_AWS_PROFILE :="bb-dev-deploymaster"
+LOCAL_OS_AWS_REGION := us-east-1
+
+TF_PWD_DIR := $(shell pwd)
+TF_VER := 0.12.28
+TF_PWD_CONT_DIR := "/go/src/project/"
+TF_DOCKER_ENTRYPOINT := /usr/local/go/bin/terraform
+TF_DOCKER_IMAGE := binbash/terraform-resources
+
+TERRATEST_DOCKER_ENTRYPOINT := dep
+TERRATEST_DOCKER_WORKDIR := /go/src/project/tests
+
+#
+# TERRAFORM
+#
+define TF_CMD_PREFIX
+docker run --rm \
+-v ${TF_PWD_DIR}:${TF_PWD_CONT_DIR}:rw \
+--entrypoint=${TF_DOCKER_ENTRYPOINT} \
+-w ${TF_PWD_CONT_DIR} \
+-it ${TF_DOCKER_IMAGE}:${TF_VER}
+endef
+
+#
+# TERRATEST
+#
+define TERRATEST_GO_CMD_PREFIX
+docker run --rm \
+-v ${TF_PWD_DIR}:${TF_PWD_CONT_DIR}:rw \
+-v ${LOCAL_OS_SSH_DIR}:/root/.ssh \
+-v ${LOCAL_OS_GIT_CONF_DIR}:/etc/gitconfig \
+-v ${LOCAL_OS_AWS_CONF_DIR}:/root/.aws/${PROJECT_SHORT} \
+-e AWS_SHARED_CREDENTIALS_FILE=/root/.aws/${PROJECT_SHORT}/credentials \
+-e AWS_CONFIG_FILE=/root/.aws/${PROJECT_SHORT}/config \
+-w ${TERRATEST_DOCKER_WORKDIR} \
+-it ${TF_DOCKER_IMAGE}:${TF_VER}
+endef
+
+define TERRATEST_GO_CMD_BASH_PREFIX
+docker run --rm \
+-v ${TF_PWD_DIR}:${TF_PWD_CONT_DIR}:rw \
+-v ${LOCAL_OS_SSH_DIR}:/root/.ssh \
+-v ${LOCAL_OS_GIT_CONF_DIR}:/etc/gitconfig \
+-v ${LOCAL_OS_AWS_CONF_DIR}:/root/.aws/${PROJECT_SHORT} \
+-e AWS_SHARED_CREDENTIALS_FILE=/root/.aws/${PROJECT_SHORT}/credentials \
+-e AWS_CONFIG_FILE=/root/.aws/${PROJECT_SHORT}/config \
+-w ${TERRATEST_DOCKER_WORKDIR} \
+--entrypoint=bash \
+-it ${TF_DOCKER_IMAGE}:${TF_VER}
+endef
+
+define TERRATEST_DEP_CMD_PREFIX
+docker run --rm \
+-v ${TF_PWD_DIR}:${TF_PWD_CONT_DIR}:rw \
+-v ${LOCAL_OS_SSH_DIR}:/root/.ssh \
+-v ${LOCAL_OS_GIT_CONF_DIR}:/etc/gitconfig \
+--entrypoint=${TERRATEST_DOCKER_ENTRYPOINT} \
+-it ${TF_DOCKER_IMAGE}:${TF_VER}
+endef
+
+help:
+ @echo 'Available Commands:'
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " - \033[36m%-18s\033[0m %s\n", $$1, $$2}'
+
+#==============================================================#
+# TERRAFORM #
+#==============================================================#
+version: ## Show terraform version
+ docker run --rm \
+ --entrypoint=${TF_DOCKER_ENTRYPOINT} \
+ -t ${TF_DOCKER_IMAGE}:${TF_VER} version
+
+format: ## The terraform fmt is used to rewrite tf conf files to a canonical format and style.
+ ${TF_CMD_PREFIX} fmt -recursive
+
+format-check: ## The terraform fmt is used to rewrite tf conf files to a canonical format and style.
+ ${TF_CMD_PREFIX} fmt -check -recursive
+
+pre-commit: ## Execute validation: pre-commit run --all-files.
+ pre-commit run --all-files
+
+terraform-docs: ## A utility to generate documentation from Terraform 0.12 modules in various output formats.
+ docker run --rm \
+ -v $$(pwd):/data \
+ cytopia/terraform-docs:0.6.0 \
+ terraform-docs-012 --sort-inputs-by-required --with-aggregate-type-defaults markdown table .
+
+tflint: ## TFLint is a Terraform linter for detecting errors that can not be detected by terraform plan (tf0.12 > 0.10.x).
+ docker run --rm \
+ -v ${LOCAL_OS_AWS_CONF_DIR}:/root/.aws \
+ -v ${TF_PWD_DIR}:/data \
+ -t wata727/tflint:0.13.2
+
+tflint-deep: ## TFLint is a Terraform linter for detecting errors that can not be detected by terraform plan (tf0.12 > 0.10.x).
+ docker run --rm \
+ -v ${LOCAL_OS_AWS_CONF_DIR}:/root/.aws \
+ -v ${TF_PWD_DIR}:/data \
+ -t wata727/tflint:0.13.2 --deep \
+ --aws-profile=${LOCAL_OS_AWS_PROFILE} \
+ --aws-creds-file=/root/.aws/credentials \
+ --aws-region=${LOCAL_OS_AWS_REGION}
+
+#==============================================================#
+# TERRATEST #
+#==============================================================#
+terratest-dep-init: ## dep is a dependency management tool for Go. (https://github.com/golang/dep)
+ ${TERRATEST_DEP_CMD_PREFIX} init
+ ${TERRATEST_DEP_CMD_PREFIX} ensure
+ sudo chown -R ${LOCAL_OS_USER_ID}:${LOCAL_OS_GROUP_ID} .
+ cp -r ./vendor ./tests/ && rm -rf ./vendor
+ cp -r ./Gopkg* ./tests/ && rm -rf ./Gopkg*
+
+terratest-go-test: ## Run E2E terratests
+ ${TERRATEST_GO_CMD_PREFIX} test -timeout 20m
+ sudo chown -R ${LOCAL_OS_USER_ID}:${LOCAL_OS_GROUP_ID} .
+
+terratest-go-test-bash: ## Run E2E terratests interactive bash
+ ${TERRATEST_GO_CMD_BASH_PREFIX}
+
+#==============================================================#
+# CIRCLECI #
+#==============================================================#
+circleci-validate-config: ## Validate A CircleCI Config (https://circleci.com/docs/2.0/local-cli/)
+ circleci config validate .circleci/config.yml
diff --git a/Makefile.release b/Makefile.release
new file mode 100644
index 0000000..d4c99f9
--- /dev/null
+++ b/Makefile.release
@@ -0,0 +1,175 @@
+.PHONY: help
+SHELL := /bin/bash
+LOCAL_OS_USER := $(shell whoami)
+LOCAL_OS_SSH_DIR := ~/.ssh
+LOCAL_OS_GIT_CONF_DIR := ~/.gitconfig
+LOCAL_PWD_DIR := $(shell pwd)
+
+#
+# GIT-RELEASE
+#
+# pre-req -> https://github.com/pnikosis/semtag
+define GIT_SEMTAG_CMD_PREFIX
+docker run --rm \
+-v ${LOCAL_PWD_DIR}:/data:rw \
+-v ${LOCAL_OS_SSH_DIR}:/root/.ssh \
+-v ${LOCAL_OS_GIT_CONF_DIR}:/etc/gitconfig \
+--entrypoint=/opt/semtag/semtag/semtag \
+-it binbash/git-release
+endef
+
+GIT_SEMTAG_VER_PATCH := $(shell ${GIT_SEMTAG_CMD_PREFIX} final -s patch -o)
+GIT_SEMTAG_VER_MINOR := $(shell ${GIT_SEMTAG_CMD_PREFIX} final -s minor -o)
+GIT_SEMTAG_VER_MAJOR := $(shell ${GIT_SEMTAG_CMD_PREFIX} final -s major -o)
+
+help:
+ @echo 'Available Commands:'
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " - \033[36m%-18s\033[0m %s\n", $$1, $$2}'
+
+#==============================================================#
+# GIT RELEASE #
+#==============================================================#
+
+#===================================#
+# GIT RELEASE: CircleCI Jobs cmds #
+#===================================#
+release-patch-with-changelog-circleci: ## make -f Makefile.release changelog-patch && git add && git commit && make -f Makefile.release release-patch
+ make -f Makefile.release changelog-patch
+ git status
+ git add CHANGELOG.md
+ git commit -m "Updating CHANGELOG.md via make -f Makefile.release changelog-patch for ${GIT_SEMTAG_VER_PATCH} [ci skip]"
+ git push origin master
+ make -f Makefile.release release-patch
+
+release-minor-with-changelog-circleci: ## make -f Makefile.release changelog-minor && git add && git commit && make -f Makefile.release release-minor
+ make -f Makefile.release changelog-minor
+ git status
+ git add CHANGELOG.md
+ git commit -m "Updating CHANGELOG.md via make -f Makefile.release changelog-minor for ${GIT_SEMTAG_VER_MINOR} [ci skip]"
+ git push origin master
+ make -f Makefile.release release-minor
+
+release-major-with-changelog-circleci: ## make -f Makefile.release changelog-major && git add && git commit && make -f Makefile.release release-major
+ make -f Makefile.release changelog-major
+ git status
+ git add CHANGELOG.md
+ git commit -m "Updating CHANGELOG.md via make -f Makefile.release changelog-major for ${GIT_SEMTAG_VER_MAJOR} [ci skip]"
+ git push origin master
+ make -f Makefile.release release-major
+
+#===================================#
+# GIT RELEASE: Localhost cmds #
+#===================================#
+#
+# VERSION NUMBER: PATCH
+#
+release-patch: ## releasing patch (eg: 0.0.1 -> 0.0.2) based on semantic tagging script for Git
+ # pre-req -> https://github.com/pnikosis/semtag
+ ${GIT_SEMTAG_CMD_PREFIX} get
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.git
+ ${GIT_SEMTAG_CMD_PREFIX} final -s patch
+
+release-patch-with-changelog: ## make -f Makefile.release changelog-patch && git add && git commit && make -f Makefile.release release-patch
+ @if git status | grep 'nothing to commit, working directory clean'; then\
+ make -f Makefile.release changelog-patch;\
+ git status;\
+ git add CHANGELOG.md;\
+ git commit -m "Updating CHANGELOG.md via make -f Makefile.release changelog-patch for ${GIT_SEMTAG_VER_PATCH} [ci skip]";\
+ git push origin master;\
+ make -f Makefile.release release-patch;\
+ else\
+ echo "===============================================================================================";\
+ echo "Changes in working directory pending to be pushed - please check 'git status' cmd output below ";\
+ echo "===============================================================================================";\
+ echo "$$(git status)";\
+ echo "===============================================================================================";\
+ fi
+
+#
+# VERSION NUMBER: MINOR
+#
+release-minor: ## releasing minor (eg: 0.0.2 -> 0.1.0) based on semantic tagging script for Git
+ # pre-req -> https://github.com/pnikosis/semtag
+ ${GIT_SEMTAG_CMD_PREFIX} get
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.git
+ ${GIT_SEMTAG_CMD_PREFIX} final -s minor
+
+release-minor-with-changelog: ## make -f Makefile.release changelog-minor && git add && git commit && make -f Makefile.release release-minor
+ @if git status |grep 'nothing to commit, working directory clean'; then\
+ make -f Makefile.release changelog-minor;\
+ git status;\
+ git add CHANGELOG.md;\
+ git commit -m "Updating CHANGELOG.md via make -f Makefile.release changelog-minor for ${GIT_SEMTAG_VER_MINOR} [ci skip]";\
+ git push origin master;\
+ make -f Makefile.release release-minor;\
+ else\
+ echo "===============================================================================================";\
+ echo "Changes in working directory pending to be pushed - please check 'git status' cmd output below ";\
+ echo "===============================================================================================";\
+ echo "$$(git status)";\
+ echo "===============================================================================================";\
+ fi
+
+#
+# VERSION NUMBER: MAJOR
+#
+release-major: ## releasing major (eg: 0.1.0 -> 1.0.0) based on semantic tagging script for Git
+ # pre-req -> https://github.com/pnikosis/semtag
+ ${GIT_SEMTAG_CMD_PREFIX} get
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.git
+ ${GIT_SEMTAG_CMD_PREFIX} final -s major
+
+release-major-with-changelog: ## make -f Makefile.release changelog-major && git add && git commit && make -f Makefile.release release-major
+ @if git status |grep 'nothing to commit, working directory clean'; then\
+ make -f Makefile.release changelog-major;\
+ git status;\
+ git add CHANGELOG.md;\
+ git commit -m "Updating CHANGELOG.md via make -f Makefile.release changelog-major for ${GIT_SEMTAG_VER_MAJOR} [ci skip]";\
+ git push origin master;\
+ make -f Makefile.release release-major;\
+ else\
+ echo "===============================================================================================";\
+ echo "Changes in working directory pending to be pushed - please check 'git status' cmd output below ";\
+ echo "===============================================================================================";\
+ echo "$$(git status)";\
+ echo "===============================================================================================";\
+ fi
+
+#==============================================================#
+# CHANGELOG #
+#==============================================================#
+changelog-init: ## git-chglog (https://github.com/git-chglog/git-chglog) config initialization -> ./.chglog
+ @if [ ! -d ./.chglog ]; then\
+ docker run --rm -v ${LOCAL_PWD_DIR}:/data -it binbash/git-release --init;\
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.chglog;\
+ else\
+ echo "==============================";\
+ echo "git-chglog already initialized";\
+ echo "==============================";\
+ echo "$$(ls ./.chglog)";\
+ echo "==============================";\
+ fi
+
+changelog-patch: ## git-chglog generation for path release
+ docker run --rm -v ${LOCAL_PWD_DIR}:/data \
+ -it binbash/git-release -o CHANGELOG.md --next-tag ${GIT_SEMTAG_VER_PATCH} \
+ | grep -v 'Warning: Permanently added the RSA host key for IP address'
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.chglog
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.git
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./CHANGELOG.md
+
+changelog-minor: ## git-chglog generation for minor release
+ docker run --rm -v ${LOCAL_PWD_DIR}:/data -it \
+ binbash/git-release -o CHANGELOG.md --next-tag ${GIT_SEMTAG_VER_MINOR} \
+ | grep -v 'Warning: Permanently added the RSA host key for IP address'
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.chglog
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.git
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./CHANGELOG.md
+
+changelog-major: ## git-chglog generation for major release
+ docker run --rm -v ${LOCAL_PWD_DIR}:/data -it \
+ binbash/git-release -o CHANGELOG.md --next-tag ${GIT_SEMTAG_VER_MAJOR} \
+ | grep -v 'Warning: Permanently added the RSA host key for IP address'
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.chglog
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./.git
+ sudo chown -R ${LOCAL_OS_USER}:${LOCAL_OS_USER} ./CHANGELOG.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a6608ee
--- /dev/null
+++ b/README.md
@@ -0,0 +1,61 @@
+
+

+
+
+

+
+
+# Terraform Module: AWS VPC Nat Gateway notifications
+
+## Overview
+
+CloudWatch Alarm that enables notifications to an SNS topic when VPC Nat Gateway has 0 active connections for more than 60 mins.
+
+Creates the following resources:
+
+* CloudWatch metric to send notifications via pre-existing SNS when the total number of concurrent
+active TCP connections through the NAT gateway is zero, which indicates that there are no active
+connections through the NAT gateway.
+* Statistics: The most useful statistic is Max.
+
+## Examples
+
+### VPC Nat Gateway active cx zero notification
+
+```hcl
+
+module "natgw-notifications" {
+ source = "binbashar/natgw-notifications/aws"
+ version = "0.0.1"
+
+ sns_topic_name = "slack-events"
+}
+```
+
+
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|:----:|:-----:|:-----:|
+| sns\_topic\_name | The name of the SNS topic to send root login notifications. | string | n/a | yes |
+| alarm\_suffix | Suffix to add to alarm name, used for separating different AWS account. | string | `""` | no |
+| send\_sns | If true will send message *Successful AWS console login with the root account* to SNS topic | bool | `"false"` | no |
+
+
+
+# TODO
+* Add examples dir + associated terratests
+
+---
+
+# Release Management
+### CircleCi PR auto-release job
+
+
+

+
+
+- [**pipeline-job**](https://circleci.com/gh/binbashar/terraform-aws-natgw-notifications) (**NOTE:** Will only run after merged PR)
+- [**releases**](https://github.com/binbashar/terraform-aws-natgw-notifications/releases)
+- [**changelog**](https://github.com/binbashar/terraform-aws-natgw-notifications/blob/master/CHANGELOG.md)
diff --git a/figures/binbash-leverage-terraform.png b/figures/binbash-leverage-terraform.png
new file mode 100644
index 0000000..6c4f09f
Binary files /dev/null and b/figures/binbash-leverage-terraform.png differ
diff --git a/figures/binbash.png b/figures/binbash.png
new file mode 100755
index 0000000..595b4b9
Binary files /dev/null and b/figures/binbash.png differ
diff --git a/figures/circleci.png b/figures/circleci.png
new file mode 100644
index 0000000..6e3a37b
Binary files /dev/null and b/figures/circleci.png differ
diff --git a/main.tf b/main.tf
new file mode 100644
index 0000000..3d99a6a
--- /dev/null
+++ b/main.tf
@@ -0,0 +1,26 @@
+#
+# SNS
+#
+data "aws_sns_topic" "main" {
+ name = var.sns_topic_name
+}
+
+#
+# CloudWatch Event
+#
+resource "aws_cloudwatch_metric_alarm" "alarm_cw_natgw_active_cx" {
+ count = var.send_sns ? 1 : 0
+
+ alarm_name = var.alarm_suffix == "" ? "vpc-natgw-active-cx-count-alarm" : "vpc-natgw-active-cx-count-alarm-${var.alarm_suffix}"
+ comparison_operator = "EqualToThreshold"
+ evaluation_periods = "1"
+ datapoints_to_alarm = "1"
+ metric_name = "ActiveConnectionCount"
+ namespace = "AWS/NATGateway"
+ period = "3600" // 60 mins
+ statistic = "Maximum"
+ threshold = "0"
+ alarm_description = "VPC Nat Gateway CW ActiveConnectionCount Rule has been triggered"
+ alarm_actions = [data.aws_sns_topic.main.arn]
+ ok_actions = [data.aws_sns_topic.main.arn]
+}
diff --git a/variables.tf b/variables.tf
new file mode 100644
index 0000000..44b83bb
--- /dev/null
+++ b/variables.tf
@@ -0,0 +1,16 @@
+variable "sns_topic_name" {
+ type = string
+ description = "The name of the SNS topic to send root login notifications."
+}
+
+variable "send_sns" {
+ type = bool
+ default = false
+ description = "If true will send message *Successful AWS console login with the root account* to SNS topic"
+}
+
+variable "alarm_suffix" {
+ type = string
+ default = ""
+ description = "Suffix to add to alarm name, used for separating different AWS account."
+}
diff --git a/versions.tf b/versions.tf
new file mode 100644
index 0000000..ac97c6a
--- /dev/null
+++ b/versions.tf
@@ -0,0 +1,4 @@
+
+terraform {
+ required_version = ">= 0.12"
+}