-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (32 loc) · 959 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
export
## Terraform
ifndef env
override env = default
endif
workspace = $(env)
tf_build_args =-var-file="$(CONFIG_DIR)/variables/global.tfvars" -var-file="$(CONFIG_DIR)/variables/$(env).tfvars"
TF_BACKEND_CONFIG=backend.hcl
CONFIG_DIR=../../ai-gov-uk-website-infra-config
tf_set_workspace:
terraform -chdir=terraform/ workspace select $(workspace)
tf_new_workspace:
terraform -chdir=terraform/ workspace new $(workspace)
tf_set_or_create_workspace:
make tf_set_workspace || make tf_new_workspace
.PHONY: tf_init
tf_init:
terraform -chdir=./terraform/ init \
-backend-config='$(CONFIG_DIR)/$(TF_BACKEND_CONFIG)' \
-backend-config="dynamodb_table=terraform_state" \
${args}
.PHONY: tf_fmt
tf_fmt:
terraform fmt
.PHONY: tf_plan
tf_plan:
make tf_set_workspace && \
terraform -chdir=./terraform/ plan ${tf_build_args} ${args}
.PHONY: tf_plan
tf_apply:
make tf_set_workspace && \
terraform -chdir=./terraform/ apply ${tf_build_args} ${args}