|
1 | 1 | .PHONY: help test init plan apply destroy fmt validate lint security clean install-tools |
2 | 2 |
|
3 | 3 | help: |
4 | | - @echo "Available targets:" |
5 | | - @echo " test - Run all tests" |
6 | | - @echo " install-tools - Install testing dependencies" |
7 | | - @echo " init - Initialize Terraform" |
8 | | - @echo " plan - Show execution plan" |
9 | | - @echo " apply - Apply infrastructure changes" |
10 | | - @echo " destroy - Destroy infrastructure" |
11 | | - @echo " fmt - Format Terraform files" |
12 | | - @echo " validate - Validate configuration" |
13 | | - @echo " lint - Run tflint" |
14 | | - @echo " security - Run security scan" |
15 | | - @echo " clean - Clean up generated files" |
| 4 | + @echo "Available targets:" |
| 5 | + @echo " test - Run all tests" |
| 6 | + @echo " install-tools - Install testing dependencies" |
| 7 | + @echo " init - Initialize Terraform" |
| 8 | + @echo " install - Install services to systemd" |
| 9 | + @echo " plan - Show execution plan" |
| 10 | + @echo " apply - Apply infrastructure changes" |
| 11 | + @echo " destroy - Destroy infrastructure" |
| 12 | + @echo " fmt - Format Terraform files" |
| 13 | + @echo " validate - Validate configuration" |
| 14 | + @echo " lint - Run tflint" |
| 15 | + @echo " security - Run security scan" |
| 16 | + @echo " clean - Clean up generated files" |
16 | 17 |
|
17 | 18 | test: |
18 | | - @./tests/test-terraform.sh |
| 19 | + @./tests/test-terraform.sh |
19 | 20 |
|
20 | 21 | install-tools: |
21 | | - @chmod +x tests/install-tools.sh |
22 | | - @./tests/install-tools.sh |
| 22 | + @chmod +x tests/install-tools.sh |
| 23 | + @./tests/install-tools.sh |
23 | 24 |
|
24 | 25 | init: |
25 | | - terraform init |
| 26 | + terraform init |
| 27 | + |
| 28 | +install: |
| 29 | + @echo "Installing services to /etc/systemd/system/..." |
| 30 | + sudo ln -sf $(PWD)/generated/*.service /etc/systemd/system/ |
| 31 | + sudo ln -sf $(PWD)/generated/*.timer /etc/systemd/system/ |
| 32 | + sudo systemctl daemon-reload |
| 33 | + @echo "Services installed. Use 'sudo systemctl start <name>' to run them." |
26 | 34 |
|
27 | 35 | plan: init |
28 | | - terraform plan |
| 36 | + terraform plan |
29 | 37 |
|
30 | 38 | apply: test |
31 | | - ./safe-apply.sh |
| 39 | + ./safe-apply.sh |
32 | 40 |
|
33 | 41 | destroy: |
34 | | - terraform destroy |
| 42 | + terraform destroy |
35 | 43 |
|
36 | 44 | fmt: |
37 | | - terraform fmt -recursive |
| 45 | + terraform fmt -recursive |
38 | 46 |
|
39 | 47 | validate: init |
40 | | - terraform validate |
| 48 | + terraform validate |
41 | 49 |
|
42 | 50 | lint: |
43 | | - @if command -v tflint >/dev/null 2>&1; then \ |
44 | | - tflint --config tests/.tflint.hcl --init; \ |
45 | | - tflint --config tests/.tflint.hcl; \ |
46 | | - else \ |
47 | | - echo "tflint not installed. Run: make install-tools"; \ |
48 | | - exit 1; \ |
49 | | - fi |
| 51 | + @if command -v tflint >/dev/null 2>&1; then \ |
| 52 | + tflint --config tests/.tflint.hcl --init; \ |
| 53 | + tflint --config tests/.tflint.hcl; \ |
| 54 | + else \ |
| 55 | + echo "tflint not installed. Run: make install-tools"; \ |
| 56 | + exit 1; \ |
| 57 | + fi |
50 | 58 |
|
51 | 59 | security: |
52 | | - @if command -v checkov >/dev/null 2>&1; then \ |
53 | | - checkov -d . --config-file tests/.checkov.yaml; \ |
54 | | - else \ |
55 | | - echo "checkov not installed. Run: make install-tools"; \ |
56 | | - exit 1; \ |
57 | | - fi |
| 60 | + @if command -v checkov >/dev/null 2>&1; then \ |
| 61 | + checkov -d . --config-file tests/.checkov.yaml; \ |
| 62 | + else \ |
| 63 | + echo "checkov not installed. Run: make install-tools"; \ |
| 64 | + exit 1; \ |
| 65 | + fi |
58 | 66 |
|
59 | 67 | clean: |
60 | | - rm -rf .terraform |
61 | | - rm -f .terraform.lock.hcl |
62 | | - rm -f terraform.tfstate |
63 | | - rm -f terraform.tfstate.backup |
64 | | - rm -f plan.tfplan |
65 | | - rm -rf generated/ |
| 68 | + rm -rf .terraform |
| 69 | + rm -f .terraform.lock.hcl |
| 70 | + rm -f terraform.tfstate |
| 71 | + rm -f terraform.tfstate.backup |
| 72 | + rm -f plan.tfplan |
| 73 | + rm -rf generated/ |
0 commit comments