-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (67 loc) · 2.36 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
SHELL := /bin/bash
# Define default target
.DEFAULT_GOAL := help
.PHONY: help init fmt validate plan apply destroy clean
# Help target
help:
@echo "Usage: make <target>"
@echo ""
@echo "Available targets:"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
nb = sub(/^## /, "", helpMsg); \
if (nb == 0) { \
helpMsg = $$0; \
nb = sub(/^[^:]*:.* ## /, "", helpMsg); \
} \
if (nb) \
print " " $$1 "\t" helpMsg; \
} \
{ helpMsg = $$0 }' $(MAKEFILE_LIST) | column -t -s ':'
setup: ## Setup project
@echo "Setting up project..."
@echo "Installing Terraform..."
@brew install terraform
@echo "Installing AWS CLI..."
@brew install awscli
@echo "Installing AWS SAM CLI..."
@brew tap aws/tap
@brew install aws-sam-cli
@echo "Installing poetry..."
@brew install poetry
@echo "Installing pre-commit..."
@brew install pre-commit
@echo "Installing pre-commit hooks..."
@pre-commit install
@echo "Project setup complete!"
create-virtualenv: ## Create virtual environment
@echo "Creating virtual environment..."
poetry install
create-target-dir: ## Delete and create target directory
@echo "Deleting and creating target directory..."
rm -rf target
mkdir target
generate-lambda-zip: create-target-dir ## Generate Lambda function ZIP archive
@echo "Generating Lambda function ZIP archive..."
rm -rf lambda_function_payload.zip
cd lambda && zip -r ../target/lambda_function_payload.zip .
init: ## Initialize Terraform
cd terraform && terraform init
# Format Terraform files
fmt: ## Format Terraform files
cd terraform && terraform fmt -recursive
validate: ## Validate Terraform files
cd terraform && terraform validate
plan-dev: ## Plan Dev Terraform changes
cd terraform && terraform plan -var-file=environments/dev.tfvars
apply-dev: ## Apply Dev Terraform changes
cd terraform && terraform apply -var-file=environments/dev.tfvars
destroy-dev: ## Destroy Dev Terraform resources
cd terraform && terraform destroy -var-file=environments/dev.tfvars
plan-prod: ## Plan Prod Terraform changes
cd terraform && terraform plan -var-file=environments/prod.tfvars
apply-prod: ## Apply Prod Terraform changes
cd terraform && terraform apply -var-file=environments/prod.tfvars
destroy-prod: ## Destroy Prod Terraform resources
cd terraform && terraform destroy -var-file=environments/prod.tfvars
clean: ## Clean up Terraform workspace
cd terraform && rm -rf .terraform terraform.tfstate*