-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
31 lines (23 loc) · 1.03 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
TERRAFORM_ENVIRONMENT?=local
#for logging add TF_LOG=TRACE to the start of a terraform call
default:
@echo "Terraform Make"
@echo "Please run 'make init' first"
@echo "Commands available: init, plan, apply and destroy"
@echo "For init-backend please set the PROJECT_NAME env variable"
@echo
@echo "Environment variables"
@echo "TERRAFORM_ENVIRONMENT="${TERRAFORM_ENVIRONMENT}
@echo "TERRAFORM_BACKEND="${TERRAFORM_BACKEND}
perms:
@chmod 0755 terraform.d/plugins/linux_amd64/custom-provider
init:
@terraform init -input=false
init-backend:
@terraform init -input=false -backend-config="key=${PROJECT_NAME}-${TERRAFORM_ENVIRONMENT}" -backend-config="access_key=${AWS_ACCESS_KEY_ID}" -backend-config="secret_key=${AWS_SECRET_ACCESS_KEY}"
plan: perms
@terraform plan -input=false -out=terraform.plan -var-file=environments/${TERRAFORM_ENVIRONMENT}/terraform.tfvars
apply: perms
@terraform apply -input=false terraform.plan
destroy: perms
@terraform destroy -input=false -var-file=environments/${TERRAFORM_ENVIRONMENT}/terraform.tfvars