-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 947 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
TF_STATE_DIR=generated
TF_STATE=$(TF_STATE_DIR)/terraform.tfstate
WORKSPACE=examples/individual-os-nova
REQUIREMENTS=installer/requirements.txt
$(WORKSPACE)/.terraform:
cd $(WORKSPACE) && \
terraform init
venv/bin/activate:
virtualenv venv -p python3 && \
source venv/bin/activate && \
pip3 install -r $(REQUIREMENTS)
.PHONY: init
init: venv/bin/activate $(WORKSPACE)/.terraform
.PHONY: apply
apply: init
. venv/bin/activate && \
cd $(WORKSPACE) && \
terraform apply -auto-approve -state $(TF_STATE)
.PHONY: plan
plan: init
. venv/bin/activate && \
cd $(WORKSPACE) && \
terraform plan -state $(TF_STATE)
.PHONY: show
show:
cd $(WORKSPACE)/$(TF_STATE_DIR) && \
terraform show
.PHONY: destroy
destroy: init
. venv/bin/activate && \
cd $(WORKSPACE) && \
terraform destroy -state $(TF_STATE)
.PHONY: rke-up
rke-up:
cd $(WORKSPACE)/$(TF_STATE_DIR) && \
rke up
.PHONY: clean
clean:
rm -fr venv
rm -fr $(WORKSPACE)/.terraform