-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
45 lines (34 loc) · 1.23 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
32
33
34
35
36
37
38
39
40
41
42
## Before we start test that we have the mandatory executables available
#EXECUTABLES = git terraform
#K := $(foreach exec,$(EXECUTABLES),\
#$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH, consider apt-get install $(exec)")))
DEV_BUCKET="terraform-state-storage-s3-practice"
DEV_STATE_LOCK_TABLE = "test"
DEV_REGION = "us-east-2"
DEV_STATE_FILE="terraform.tfstate"
.PHONY: plan
init:
@echo "initialize remote state file"
cd layers/$(LAYER) && \
rm -rf .terraform/modules/ && \
terraform init -backend-config="bucket=$(DEV_BUCKET)" -backend-config="key=$(DEV_STATE_FILE)" -backend-config="dynamodb_table=$(DEV_STATE_LOCK_TABLE)" -backend-config="region=$(DEV_REGION)"
validate: init
@echo "running terraform validate"
cd layers/$(LAYER) && \
terraform validate -no-color
plan: validate
@echo "running terraform plan"
cd layers/$(LAYER) && \
terraform plan -no-color
apply: plan
@echo "running terraform apply"
cd layers/$(LAYER) && \
terraform apply -auto-approve -no-color
plan-destroy: validate
@echo "running terraform plan -destroy"
cd layers/$(LAYER) && \
terraform plan -destroy -no-color
destroy: init
@echo "running terraform destroy"
cd layers/$(LAYER) && \
terraform destroy -force -no-color