This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
forked from f5devcentral/f5-azure-saca
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
116 lines (105 loc) · 3.26 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.PHONY: build run test azure shell destroy
export DIR = $(shell pwd)
export WORK_DIR = $(shell dirname ${DIR})
export CONTAINER_IMAGE = 'f5-scca-terraform'
run: build shell
build:
docker build -t ${CONTAINER_IMAGE} .
shell:
@echo "tf shell ${WORK_DIR}"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
-v ${SSH_KEY_DIR}/:/root/.ssh/:ro \
${CONTAINER_IMAGE} \
azure:
@#terraform init, plan, apply
@echo "init, plan, apply"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
${CONTAINER_IMAGE} \
sh -c "terraform init; terraform plan; terraform apply --auto-approve"
gov:
@#terraform init, plan, apply
@echo "init, plan, apply"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
-e ARM_ENVIRONMENT=${ARM_ENVIRONMENT} \
${CONTAINER_IMAGE} \
sh -c "terraform init; terraform plan; terraform apply --auto-approve"
plan:
@#terraform plan
@echo "plan"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
${CONTAINER_IMAGE} \
sh -c "terraform plan"
destroy:
@#terraform destroy --auto-approve
@echo "destroy"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
${CONTAINER_IMAGE} \
sh -c "terraform destroy --auto-approve"
revolution:
@#terraform destroy --auto-approve
@echo "destroy"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
-e ARM_ENVIRONMENT=${ARM_ENVIRONMENT} \
${CONTAINER_IMAGE} \
sh -c "terraform destroy --auto-approve"
test: build test1 test2 test3
test1:
@echo "terraform install"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
${CONTAINER_IMAGE} \
sh -c "terraform --version "
test2:
@echo "terraform init"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
${CONTAINER_IMAGE} \
sh -c "terraform init "
test3:
@echo "terraform validate"
@docker run --rm -it \
--volume ${DIR}:/workspace \
-e ARM_CLIENT_ID=${ARM_CLIENT_ID} \
-e ARM_CLIENT_SECRET=${ARM_CLIENT_SECRET} \
-e ARM_SUBSCRIPTION_ID=${ARM_SUBSCRIPTION_ID} \
-e ARM_TENANT_ID=${ARM_TENANT_ID} \
${CONTAINER_IMAGE} \
sh -c "terraform validate "