Skip to content

Commit b52be76

Browse files
committed
chore: updating the makefile and the layout
1 parent 1f2f4e6 commit b52be76

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

Makefile

+46-7
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,22 @@
1616
#
1717
AUTHOR_EMAIL[email protected]
1818

19-
.PHONY: all security lint format documentation documentation-examples
19+
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init
2020

2121
default: all
2222

2323
all:
2424
$(MAKE) init
2525
$(MAKE) validate
26-
$(MAKE) security
2726
$(MAKE) lint
27+
$(MAKE) security
2828
$(MAKE) format
2929
$(MAKE) documentation
30-
$(MAKE) documentation-examples
31-
32-
security:
33-
@echo "--> Running Security checks"
34-
@tfsec .
3530

3631
documentation:
3732
@echo "--> Generating documentation"
3833
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .
34+
$(MAKE) documentation-examples
3935

4036
documentation-examples:
4137
@echo "--> Generating documentation examples"
@@ -45,15 +41,58 @@ init:
4541
@echo "--> Running terraform init"
4642
@terraform init -backend=false
4743

44+
security:
45+
@echo "--> Running Security checks"
46+
@tfsec .
47+
$(MAKE) security-examples
48+
49+
security-examples:
50+
@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
60+
4861
validate:
4962
@echo "--> Running terraform validate"
63+
@terraform init -backend=false
5064
@terraform validate
65+
$(MAKE) validate-examples
66+
67+
validate-examples:
68+
@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; \
72+
terraform -chdir=$$dir validate; \
73+
done
5174

5275
lint:
5376
@echo "--> Running tflint"
5477
@tflint --init
5578
@tflint -f compact
79+
$(MAKE) lint-examples
80+
81+
lint-examples:
82+
@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
5688

5789
format:
5890
@echo "--> Running terraform fmt"
5991
@terraform fmt -recursive -write=true
92+
93+
clean:
94+
@echo "--> Cleaning up"
95+
@find . -type d -name ".terraform" | while read -r dir; do \
96+
echo "--> Removing $$dir"; \
97+
rm -rf $$dir; \
98+
done

data.tf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
## Find the current organization
3+
data "aws_organizations_organization" "current" {}

main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
data "aws_organizations_organization" "current" {}
32

43
## Create the default iam boundary used the pipelines
54
# tfsec:ignore:aws-iam-no-policy-wildcards

versions.tf terraform.tf

File renamed without changes.

0 commit comments

Comments
 (0)