-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathjustfile
More file actions
89 lines (71 loc) · 3.29 KB
/
Copy pathjustfile
File metadata and controls
89 lines (71 loc) · 3.29 KB
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
# ============================================================================
# Hyperswitch Suite — Development Tasks
# ============================================================================
# Usage: just <recipe>
# Install just: https://github.com/casey/just
# Default recipe — show available commands
default:
@just --list
# ============================================================================
# Terraform Documentation
# ============================================================================
# Generate terraform-docs for all module layers (base, composition, application-resources)
gen-docs:
@echo "Generating terraform-docs for all module layers..."
@for dir in $$(find terraform/aws/modules/base terraform/aws/modules/composition terraform/aws/modules/application-resources -name "main.tf" -exec dirname {} \; | sort); do \
echo " $$dir"; \
terraform-docs --config terraform/aws/modules/.terraform-docs.yml "$$dir" >/dev/null 2>&1 || true; \
done
@echo "Done."
# Generate terraform-docs for a specific module directory
gen-docs-module MODULE_DIR:
@echo "Generating terraform-docs for {{MODULE_DIR}}..."
@terraform-docs --config terraform/aws/modules/.terraform-docs.yml {{MODULE_DIR}}
# Check if terraform-docs is installed
check-docs:
@which terraform-docs >/dev/null 2>&1 && echo "terraform-docs: $$(terraform-docs --version)" || echo "terraform-docs: NOT INSTALLED (brew install terraform-docs)"
# ============================================================================
# Terraform / Terragrunt Cache Cleanup
# ============================================================================
# Clean all terraform and terragrunt cache
clean-cache: clean-terragrunt-cache clean-terraform-dirs clean-terraform-lock
# Clean .terragrunt-cache directories
clean-terragrunt-cache:
@echo "Removing .terragrunt-cache directories..."
@find . -name ".terragrunt-cache" -type d -prune -exec rm -rf {} +
@echo "Done."
# Clean .terraform directories
clean-terraform-dirs:
@echo "Removing .terraform directories..."
@find . -name ".terraform" -type d -prune -exec rm -rf {} +
@echo "Done."
# Clean .terraform.lock.hcl files
clean-terraform-lock:
@echo "Removing .terraform.lock.hcl files..."
@find . -name ".terraform.lock.hcl" -type f -delete
@echo "Done."
# List all cache directories and files (dry run)
list-cache:
@echo "=== .terragrunt-cache directories ==="
@find . -name ".terragrunt-cache" -type d 2>/dev/null | head -20 || echo "None found"
@echo ""
@echo "=== .terraform directories ==="
@find . -name ".terraform" -type d 2>/dev/null | head -20 || echo "None found"
@echo ""
@echo "=== .terraform.lock.hcl files ==="
@find . -name ".terraform.lock.hcl" -type f 2>/dev/null | head -20 || echo "None found"
# ============================================================================
# Aliases
# ============================================================================
# Abbreviated alias for clean-cache
alias cc := clean-cache
# Abbreviated alias for list-cache
alias lc := list-cache
# Abbreviated alias for clean-terragrunt-cache
alias ctc := clean-terragrunt-cache
# Abbreviated alias for clean-terraform-dirs
alias ctd := clean-terraform-dirs
# Abbreviated alias for clean-terraform-lock
alias ctl := clean-terraform-lock
# Abbreviated alias for gen-docs
alias gd := gen-docs