-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (34 loc) · 1.06 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
.PHONY: help
help: ## This help message
@awk -F: \
'/^([a-z]+.*): .*## (.+)$$/ {gsub(/: .*?\s*##/, "\t");print}' \
Makefile \
| expand -t20 \
| sort
.terraform:
terraform init
.PHONY: init
init: .terraform ## Initialize the environment
plan.out: .terraform ## Create the plan
@if [ "$(MAKECMDGOALS)" == "operator" ] ; then \
echo terraform plan -var-file values.tfvars -out plan.out -target=module.operator ; \
terraform plan -var-file values.tfvars -out plan.out -target=module.operator ; \
else \
echo terraform plan -var-file values.tfvars -out plan.out ; \
terraform plan -var-file values.tfvars -out plan.out ; \
fi
.PHONY: operator
operator: plan.out apply ## Creates the required operator
.PHONY: apply
apply: plan.out ## Apply the plan
terraform apply ./plan.out
rm -f plan.out
.PHONY: destroy
destroy: ## Destroy the deployment
terraform destroy -var-file values.tfvars
.PHONY: show
show: ## Prints the resources
@terraform show
.PHONY: show-modules
show-modules: ## Prints the modules
@terraform show | awk '/# module/ {gsub(":","");print $$2}'