-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BBL-381 | std repo structure + standalone makefile approach + README.…
…md update
- Loading branch information
1 parent
4fa7b00
commit a0d9dfa
Showing
9 changed files
with
198 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Use this file to define individuals or teams that are responsible for code in a repository. | ||
# Read more: <https://help.github.com/articles/about-codeowners/> | ||
|
||
* @binbashar/leverage-project-terraform-admin | ||
* @binbashar/leverage-project-terraform-dev | ||
* @binbashar/leverage-ref-architecture-aws-admin | ||
* @binbashar/leverage-ref-architecture-aws-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,28 @@ | ||
.PHONY: help | ||
SHELL := /bin/bash | ||
LOCAL_OS_USER := $(shell whoami) | ||
LOCAL_OS_SSH_DIR := ~/.ssh | ||
LOCAL_OS_GIT_CONF_DIR := ~/.gitconfig | ||
LOCAL_OS_AWS_CONF_DIR := ~/.aws | ||
|
||
# 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.24 | ||
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 \ | ||
-w ${TERRATEST_DOCKER_WORKDIR} \ | ||
-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 | ||
SHELL := /bin/bash | ||
MAKEFILE_PATH := ./Makefile | ||
MAKEFILES_DIR := ./@bin/makefiles | ||
|
||
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 # | ||
# INITIALIZATION # | ||
#==============================================================# | ||
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 | ||
init-makefiles: ## initialize makefiles | ||
rm -rf ${MAKEFILES_DIR} | ||
mkdir -p ${MAKEFILES_DIR} | ||
git clone https://github.com/binbashar/le-dev-makefiles.git ${MAKEFILES_DIR} | ||
echo "" >> ${MAKEFILE_PATH} | ||
sed -i '/^#include.*/s/^#//' ${MAKEFILE_PATH} | ||
|
||
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.8.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}:${LOCAL_OS_USER} . | ||
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}:${LOCAL_OS_USER} . | ||
# | ||
## IMPORTANT: Automatically managed | ||
## Must NOT UNCOMMENT the #include lines below | ||
# | ||
include ${MAKEFILES_DIR}/circleci/circleci.mk | ||
include ${MAKEFILES_DIR}/release-mgmt/release.mk | ||
include ${MAKEFILES_DIR}/terraform13/terraform13.mk | ||
include ${MAKEFILES_DIR}/terratest13/terratest13.mk | ||
|
||
#==============================================================# | ||
# CIRCLECI # | ||
#==============================================================# | ||
circleci-validate-config: ## Validate A CircleCI Config (https://circleci.com/docs/2.0/local-cli/) | ||
circleci config validate .circleci/config.yml |
Oops, something went wrong.