31
31
documentation :
32
32
@echo " --> Generating documentation"
33
33
@terraform-docs markdown table --output-file ${PWD} /README.md --output-mode inject .
34
+ $(MAKE ) documentation-modules
34
35
$(MAKE ) documentation-examples
35
36
37
+ documentation-modules :
38
+ @echo " --> Generating documentation for modules"
39
+ @if [ -d modules ]; then \
40
+ find modules -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
41
+ fi
42
+
36
43
documentation-examples :
37
44
@echo " --> Generating documentation examples"
38
- @find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \;
45
+ @if [ -d examples ]; then \
46
+ find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
47
+ fi
39
48
40
49
init :
41
50
@echo " --> Running terraform init"
@@ -44,47 +53,80 @@ init:
44
53
security :
45
54
@echo " --> Running Security checks"
46
55
@tfsec .
56
+ $(MAKE ) security-modules
47
57
$(MAKE ) security-examples
48
58
59
+ security-modules :
60
+ @echo " --> Running Security checks on modules"
61
+ @if [ -d modules ]; then \
62
+ find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
63
+ echo " --> Validating $$ dir" ; \
64
+ tfsec $$ dir; \
65
+ done ; \
66
+ fi
67
+
49
68
security-examples :
50
69
@echo " --> Running Security checks on examples"
51
- @find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
52
- echo " --> Validating $$ dir" ; \
53
- tfsec $$ dir; \
54
- done
55
-
56
- validate-all :
57
- @echo " --> Running all validation checks"
58
- $(MAKE ) validate
59
- $(MAKE ) validate-examples
70
+ @if [ -d examples ]; then \
71
+ find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
72
+ echo " --> Validating $$ dir" ; \
73
+ tfsec $$ dir; \
74
+ done ; \
75
+ fi
60
76
61
77
validate :
62
78
@echo " --> Running terraform validate"
63
79
@terraform init -backend=false
64
80
@terraform validate
81
+ $(MAKE ) validate-modules
65
82
$(MAKE ) validate-examples
66
83
84
+ validate-modules :
85
+ @echo " --> Running terraform validate on modules"
86
+ @if [ -d modules ]; then \
87
+ find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
88
+ echo " --> Validating $$ dir" ; \
89
+ terraform -chdir=$$ dir init -backend=false; \
90
+ terraform -chdir=$$ dir validate; \
91
+ done ; \
92
+ fi
93
+
67
94
validate-examples :
68
95
@echo " --> Running terraform validate on examples"
69
- @find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
70
- echo " --> Validating $$ dir" ; \
71
- terraform -chdir=$$ dir init -backend=false; \
72
- terraform -chdir=$$ dir validate; \
73
- done
96
+ @if [ -d examples ]; then \
97
+ find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
98
+ echo " --> Validating $$ dir" ; \
99
+ terraform -chdir=$$ dir init -backend=false; \
100
+ terraform -chdir=$$ dir validate; \
101
+ done ; \
102
+ fi
74
103
75
104
lint :
76
105
@echo " --> Running tflint"
77
106
@tflint --init
78
107
@tflint -f compact
108
+ $(MAKE ) lint-modules
79
109
$(MAKE ) lint-examples
80
110
111
+ lint-modules :
112
+ @echo " --> Running tflint on modules"
113
+ @if [ -d modules ]; then \
114
+ find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
115
+ echo " --> Linting $$ dir" ; \
116
+ tflint --chdir=$$ dir --init; \
117
+ tflint --chdir=$$ dir -f compact; \
118
+ done ; \
119
+ fi
120
+
81
121
lint-examples :
82
122
@echo " --> Running tflint on examples"
83
- @find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
84
- echo " --> Linting $$ dir" ; \
85
- tflint --chdir=$$ dir --init; \
86
- tflint --chdir=$$ dir -f compact; \
87
- done
123
+ @if [ -d examples ]; then \
124
+ find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
125
+ echo " --> Linting $$ dir" ; \
126
+ tflint --chdir=$$ dir --init; \
127
+ tflint --chdir=$$ dir -f compact; \
128
+ done ; \
129
+ fi
88
130
89
131
format :
90
132
@echo " --> Running terraform fmt"
0 commit comments