From 7ee3e5c0bf64609b8bbff73963b98091185276a8 Mon Sep 17 00:00:00 2001 From: exequielrafaela Date: Thu, 17 Sep 2020 13:33:47 -0300 Subject: [PATCH] BBL-381 | standalone makefile approach implemented + README.md updated --- .circleci/config.yml | 28 ++++++- .gitignore | 15 +++- Makefile | 146 +++++------------------------------- Makefile.release | 175 ------------------------------------------- README.md | 84 +++++++++++++++------ versions.tf | 8 ++ 6 files changed, 126 insertions(+), 330 deletions(-) delete mode 100644 Makefile.release create mode 100644 versions.tf diff --git a/.circleci/config.yml b/.circleci/config.yml index c6ba426..22fac14 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,17 +19,27 @@ jobs: name: Context Info Cmds command: pwd && ls -ltra && git branch + - run: + name: Initialize Repo Makefiles + command: | + make init-makefiles + git update-index --assume-unchanged "Makefile" + - run: name: test1-terraform-format command: make format-check - run: name: Install awscli - command: sudo pip install awscli + command: sudo -H pip install awscli - run: name: Configure awscli command: | + # AWS credentials dir + mkdir --parents /home/circleci/.aws/bb + sudo chown -R $USER:$USER /home/circleci/.aws + # 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 @@ -39,8 +49,8 @@ jobs: # 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 @@ -63,6 +73,12 @@ jobs: name: Context Info Cmds command: pwd && ls -ltra && git branch + - run: + name: Initialize Repo Makefiles + command: | + make init-makefiles + git update-index --assume-unchanged "Makefile" + - run: name: Install awscli command: sudo pip install awscli @@ -114,6 +130,12 @@ jobs: name: Context Info Cmds command: pwd && ls -ltra && git branch + - run: + name: Initialize Repo Makefiles + command: | + make init-makefiles + git update-index --assume-unchanged "Makefile" + - run: name: Release New Version command: | @@ -123,7 +145,7 @@ jobs: 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 + make release-$VERSION_NUMBER-with-changelog-circleci else echo "===============================================================================================" echo "Changes in working directory pending to be pushed - please check 'git status' cmd output below " diff --git a/.gitignore b/.gitignore index 5bcab7f..4d64195 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,8 @@ !*.circleci !*.dockeringnore !*.hosts -!/.gitignore +!.hosts.example +!*.gitignore !/.chglog !/.gitallowed !/.github @@ -19,6 +20,7 @@ ############ id_rsa id_dsa +keys/ # OS generated files # ###################### @@ -79,9 +81,18 @@ Thumbs.db *.pgpass *.vagrant -# TF Project files # +# Project files # #################### # +# Secret Files +# +*secrets.dec.* +# +# Scripts and Makefiles +# +/@bin +!/@bin/scripts +# # Compiled files # *.tfstate diff --git a/Makefile b/Makefile index e83d96b..be680bd 100644 --- a/Makefile +++ b/Makefile @@ -1,137 +1,27 @@ .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 +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_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 +# +## 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}/terraform12/terraform12.mk +#include ${MAKEFILES_DIR}/terratest12/terratest12.mk diff --git a/Makefile.release b/Makefile.release deleted file mode 100644 index d4c99f9..0000000 --- a/Makefile.release +++ /dev/null @@ -1,175 +0,0 @@ -.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 index fc89222..c8f589e 100644 --- a/README.md +++ b/README.md @@ -18,27 +18,35 @@ If `aws_sns_topic_enabled = true` then you'll still need to subscribe to the cre - **Versions:** `>= 1.x.y` (Terraform 0.12.x compatible -> **WIP**) - eg: https://registry.terraform.io/modules/binbashar/cost-budget/aws/1.0.0 +## Requirements + +| Name | Version | +|------|---------| +| terraform | >= 0.12.28 | +| aws | >= 2.70.0 | + +## Providers + +| Name | Version | +|------|---------| +| aws | >= 2.70.0 | + ## Inputs -There are several required variables for this module. -* The `aws_env` -> environment this is running in (e.g. dev, stage, prod). -* The `monthly_billing_threshold` -> threshold of estimated charges that will trigger the alarm (a monetary amount). -* Currency is an optional variable. It defaults to USD, however you can provide any currency abbreviation (e.g. CAD, EUR, JPY) so you can seperate billing alerts by currency. I don't know if that's a common thing, but it's a provided dimension by Amazon, so I added support for it here. - | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| aws\_account\_id | AWS account id | string | `""` | no | -| aws\_env | AWS environment you are deploying to. Will be appended to SNS topic and alarm name. (e.g. dev, stage, prod) | string | n/a | yes | -| aws\_sns\_topic\_arn | If aws_sns_topic_enabled = false, then an existing AWS SNS topic ARN for the billing alert integration will be used | string | `""` | no | -| currency | Short notation for currency type (e.g. USD, CAD, EUR) | string | `"USD"` | no | -| monthly\_billing\_threshold | The threshold for which estimated monthly charges will trigger the metric alarm. | string | n/a | yes | -| tags | A mapping of tags to assign to all resources | map | `` | no | +|------|-------------|------|---------|:--------:| +| aws\_env | AWS environment you are deploying to. Will be appended to SNS topic and alarm name. (e.g. dev, stage, prod) | `string` | n/a | yes | +| monthly\_billing\_threshold | The threshold for which estimated monthly charges will trigger the metric alarm. | `string` | n/a | yes | +| aws\_account\_id | AWS account id | `string` | `""` | no | +| aws\_sns\_topic\_arn | If aws\_sns\_topic\_enabled = false, then an existing AWS SNS topic ARN for the billing alert integration will be used | `string` | `""` | no | +| currency | Short notation for currency type (e.g. USD, CAD, EUR) | `string` | `"USD"` | no | +| tags | A mapping of tags to assign to all resources | `map(string)` | `{}` | no | ## Outputs | Name | Description | |------|-------------| -| sns\_topic\_arn | SNS Topic ARN to be subscribed to in order to delivery the clodwatch billing alarms +| sns\_topic\_arn | SNS Topic ARN to be subscribed to in order to delivery the clodwatch billing alarms | The module outputs one block, sns_topic. Access it like this: @@ -118,23 +126,55 @@ module "billing_cloudwatch_alert" { !! MANUAL STEP : !! Subscribe emails to `arn:aws:sns:us-east-1:111111111111:billing-alarm-notification-usd-dev for billing alarms` + +## Binbash Leverage | DevOps Automation Code Library Integration + +In order to get the full automated potential of the +[Binbash Leverage DevOps Automation Code Library](https://leverage.binbash.com.ar/how-it-works/code-library/code-library/) +you should initialize all the necessary helper **Makefiles**. + +#### How? +You must execute the `make init-makefiles` command at the root context + + +```shell +╭─delivery at delivery-I7567 in ~/terraform/terraform-aws-backup-by-tags on master✔ 20-09-17 +╰─⠠⠵ make +Available Commands: + - init-makefiles initialize makefiles + +``` + +### Why? +You'll get all the necessary commands to automatically operate this module via a dockerized approach, +example shown below + +```shell +╭─delivery at delivery-I7567 in ~/terraform/terraform-aws-backup-by-tags on master✔ 20-09-17 +╰─⠠⠵ make +Available Commands: + - circleci-validate-config ## Validate A CircleCI Config (https + - format-check ## The terraform fmt is used to rewrite tf conf files to a canonical format and style. + - format ## The terraform fmt is used to rewrite tf conf files to a canonical format and style. + - tf-dir-chmod ## run chown in ./.terraform to gran that the docker mounted dir has the right permissions + - version ## Show terraform version + - init-makefiles ## initialize makefiles +``` + +```shell +╭─delivery at delivery-I7567 in ~/terraform/terraform-aws-backup-by-tags on master✔ 20-09-17 +╰─⠠⠵ make format-check +docker run --rm -v /home/delivery/Binbash/repos/Leverage/terraform/terraform-aws-backup-by-tags:"/go/src/project/":rw -v :/config -v /common.config:/common-config/common.config -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/etc/gitconfig -v ~/.aws/bb:/root/.aws/bb -e AWS_SHARED_CREDENTIALS_FILE=/root/.aws/bb/credentials -e AWS_CONFIG_FILE=/root/.aws/bb/config --entrypoint=/bin/terraform -w "/go/src/project/" -it binbash/terraform-awscli-slim:0.12.28 fmt -check +``` # Release Management -## Docker based makefile commands -- https://cloud.docker.com/u/binbash/repository/docker/binbash/git-release -- https://github.com/binbashar/terraform-aws-cost-billing-alarm/blob/master/Makefile - -Root directory `Makefile` has the automated steps (to be integrated with **CircleCI jobs** []() ) - ### CircleCi PR auto-release job +
leverage-circleci
-- https://circleci.com/gh/binbashar/terraform-aws-cost-billing-alarm -- **NOTE:** Will only run after merged PR. - - [**pipeline-job**](https://circleci.com/gh/binbashar/terraform-aws-cost-billing-alarm) (**NOTE:** Will only run after merged PR) - [**releases**](https://github.com/binbashar/terraform-aws-cost-billing-alarm/releases) - [**changelog**](https://github.com/binbashar/terraform-aws-cost-billing-alarm/blob/master/CHANGELOG.md) diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..da04b59 --- /dev/null +++ b/versions.tf @@ -0,0 +1,8 @@ + +terraform { + required_version = ">= 0.12.28" + + required_providers { + aws = ">= 2.70.0" + } +}