-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (22 loc) · 833 Bytes
/
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
.PHONY: check-vars clean init plan apply destroy output
check-vars-env:
ifndef environment
$(error environment is undefined)
endif
check-vars-backend: check-vars-env
ifndef project
$(error project is undefined)
endif
clean: check-vars
rm -rf .terraform
init: check-vars-backend
terraform init -backend-config="bucket=${project}-${environment}-state" -backend-config="dynamodb_table=${project}-${environment}-state-lock"
terraform workspace select ${environment} || terraform workspace new ${environment}
plan: check-vars-env
terraform plan -var-file=./vars/${environment}.tfvars
apply: check-vars-env
terraform apply -var-file=./vars/${environment}.tfvars
destroy: check-vars-env
terraform destroy -var-file=./vars/${environment}.tfvars
output: check-vars-env
terraform output -var-file=./vars/${environment}.tfvars