From 796f28eddd526c0bfd9b84ac0e4bccd20cb99cbc Mon Sep 17 00:00:00 2001 From: Ben Fortuna Date: Sun, 16 Jan 2022 13:12:07 +1100 Subject: [PATCH] Refactored build variables --- .env | 16 ++++++++++++++++ Makefile | 14 +------------- 2 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..bf5e28f --- /dev/null +++ b/.env @@ -0,0 +1,16 @@ +TERRAFORM_VERSION=1.1.0 +AWS_DEFAULT_REGION?=ap-southeast-2 + +ifneq (, $(shell which docker)) +TERRAFORM=docker run --rm -v "${PWD}:/work" -e AWS_DEFAULT_REGION=$(AWS_DEFAULT_REGION) -e http_proxy=$(http_proxy) --net=host -w /work hashicorp/terraform:$(TERRAFORM_VERSION) +else +TERRAFORM=terraform +endif + +TERRAFORM_DOCS=docker run --rm -v "${PWD}:/work" tmknom/terraform-docs + +CHECKOV=docker run --rm -v "${PWD}:/work" bridgecrew/checkov + +TFSEC=docker run --rm -v "${PWD}:/work" liamg/tfsec + +DIAGRAMS=docker run -v "${PWD}:/work" figurate/diagrams python diff --git a/Makefile b/Makefile index 9e69bf6..46505fc 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,5 @@ SHELL:=/bin/bash -AWS_DEFAULT_REGION?=ap-southeast-2 - -TERRAFORM_VERSION=0.13.4 -TERRAFORM=docker run --rm -v "${PWD}:/work" -e AWS_DEFAULT_REGION=$(AWS_DEFAULT_REGION) -e http_proxy=$(http_proxy) \ - --net=host -w /work hashicorp/terraform:$(TERRAFORM_VERSION) - -TERRAFORM_DOCS=docker run --rm -v "${PWD}:/work" tmknom/terraform-docs - -CHECKOV=docker run --rm -v "${PWD}:/work" bridgecrew/checkov - -TFSEC=docker run --rm -v "${PWD}:/work" liamg/tfsec - -DIAGRAMS=docker run -v "${PWD}:/work" figurate/diagrams python +include .env EXAMPLE=$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))