-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (42 loc) · 1.35 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
TERRAFORM_DIR := ./terraform
AUTO_APPROVE := -auto-approve
PARALLELISM := -parallelism=5
.PHONY: default
default: help
.PHONY: init
init:
@echo "Initializing Terraform..."
@cd $(TERRAFORM_DIR) && terraform init
.PHONY: apply
apply: init
@echo "Applying Terraform changes..."
@cd $(TERRAFORM_DIR) && terraform apply $(AUTO_APPROVE) $(PARALLELISM)
.PHONY: destroy
destroy:
@echo "Destroying Terraform-managed infrastructure..."
@cd $(TERRAFORM_DIR) && terraform destroy $(AUTO_APPROVE)
.PHONY: recreate
recreate: init destroy apply
.PHONY: validate
validate:
@echo "Validating Terraform files..."
@cd $(TERRAFORM_DIR) && terraform validate
.PHONY: fmt
fmt:
@echo "Formatting Terraform files..."
@cd $(TERRAFORM_DIR) && terraform fmt -recursive
.PHONY: clean
clean:
@echo "Cleaning up Terraform .tfstate backup files..."
@cd $(TERRAFORM_DIR) && rm -rf *.tfstate.backup
.PHONY: help
help:
@echo "Usage:"
@echo " make init - Initialize Terraform"
@echo " make apply - Apply Terraform changes"
@echo " make destroy - Destroy Terraform-managed infrastructure"
@echo " make recreate - Recreate Terraform-managed infrastructure"
@echo " make validate - Validate Terraform files"
@echo " make fmt - Format Terraform files"
@echo " make clean - Clean backup Terraform state files"
@echo " make help - Show this help message"