Skip to content

Commit 56f88e4

Browse files
authored
feat default policies (#41)
* feat: adding the ability to source in default managed and inline policies into the roles created * chore(deps): upgrading the terraform providers
1 parent a162cef commit 56f88e4

11 files changed

Lines changed: 300 additions & 138 deletions

File tree

.tflint.hcl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
plugin "aws" {
22
enabled = true
3-
version = "0.30.0"
3+
version = "0.32.0"
44
source = "github.com/terraform-linters/tflint-ruleset-aws"
55
}
66

7+
plugin "terraform" {
8+
enabled = true
9+
version = "0.7.0"
10+
source = "github.com/terraform-linters/tflint-ruleset-terraform"
11+
}
12+
713
config {
8-
module = true
9-
force = false
14+
call_module_type = "local"
15+
force = false
1016
}
1117

1218
rule "terraform_required_providers" {
@@ -55,7 +61,7 @@ rule "terraform_module_pinned_source" {
5561
}
5662

5763
rule "terraform_standard_module_structure" {
58-
enabled = false
64+
enabled = true
5965
}
6066

6167
rule "terraform_workspace_remote" {

Makefile

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#
2-
# Copyright (C) 2024 Appvia Ltd <info@appvia.io>
3-
#
42
# This program is free software; you can redistribute it and/or
53
# modify it under the terms of the GNU General Public License
64
# as published by the Free Software Foundation; either version 2
@@ -14,15 +12,23 @@
1412
# You should have received a copy of the GNU General Public License
1513
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1614
#
17-
AUTHOR_EMAIL=info@appvia.io
18-
19-
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init
15+
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init examples tests
2016

2117
default: all
2218

2319
all:
2420
$(MAKE) init
2521
$(MAKE) validate
22+
$(MAKE) tests
23+
$(MAKE) lint
24+
$(MAKE) security
25+
$(MAKE) format
26+
$(MAKE) documentation
27+
28+
examples:
29+
$(MAKE) validate-examples
30+
$(MAKE) tests
31+
$(MAKE) lint-examples
2632
$(MAKE) lint
2733
$(MAKE) security
2834
$(MAKE) format
@@ -31,11 +37,33 @@ all:
3137
documentation:
3238
@echo "--> Generating documentation"
3339
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .
40+
$(MAKE) documentation-modules
3441
$(MAKE) documentation-examples
3542

43+
documentation-modules:
44+
@echo "--> Generating documentation for modules"
45+
@if [ -d modules ]; then \
46+
find modules -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
47+
fi
48+
3649
documentation-examples:
3750
@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 {} \;
51+
@if [ -d examples ]; then \
52+
find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
53+
fi
54+
55+
upgrade-terraform-providers:
56+
@printf "%s Upgrading Terraform providers for %-24s" "-->" "."
57+
@terraform init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]"
58+
@$(MAKE) upgrade-terraform-example-providers
59+
60+
upgrade-terraform-example-providers:
61+
@if [ -d examples ]; then \
62+
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
63+
printf "%s Upgrading Terraform providers for %-24s" "-->" "$$dir"; \
64+
terraform -chdir=$$dir init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]"; \
65+
done; \
66+
fi
3967

4068
init:
4169
@echo "--> Running terraform init"
@@ -44,47 +72,87 @@ init:
4472
security:
4573
@echo "--> Running Security checks"
4674
@trivy config .
75+
$(MAKE) security-modules
4776
$(MAKE) security-examples
4877

78+
security-modules:
79+
@echo "--> Running Security checks on modules"
80+
@if [ -d modules ]; then \
81+
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
82+
echo "--> Validating $$dir"; \
83+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
84+
done; \
85+
fi
86+
4987
security-examples:
5088
@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-
trivy config $$dir; \
54-
done
89+
@if [ -d examples ]; then \
90+
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
91+
echo "--> Validating $$dir"; \
92+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
93+
done; \
94+
fi
5595

56-
validate-all:
57-
@echo "--> Running all validation checks"
58-
$(MAKE) validate
59-
$(MAKE) validate-examples
96+
tests:
97+
@echo "--> Running Terraform Tests"
98+
@terraform test
6099

61100
validate:
62101
@echo "--> Running terraform validate"
63102
@terraform init -backend=false
64103
@terraform validate
104+
$(MAKE) validate-modules
65105
$(MAKE) validate-examples
66106

107+
validate-modules:
108+
@echo "--> Running terraform validate on modules"
109+
@if [ -d modules ]; then \
110+
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
111+
echo "--> Validating $$dir"; \
112+
terraform -chdir=$$dir init -backend=false; \
113+
terraform -chdir=$$dir validate; \
114+
done; \
115+
fi
116+
67117
validate-examples:
68118
@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
119+
@if [ -d examples ]; then \
120+
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
121+
echo "--> Validating $$dir"; \
122+
terraform -chdir=$$dir init -backend=false; \
123+
terraform -chdir=$$dir validate; \
124+
done; \
125+
fi
126+
127+
validate-commits:
128+
@echo "--> Running commitlint against the "
74129

75130
lint:
76131
@echo "--> Running tflint"
77132
@tflint --init
78133
@tflint -f compact
134+
$(MAKE) lint-modules
79135
$(MAKE) lint-examples
80136

137+
lint-modules:
138+
@echo "--> Running tflint on modules"
139+
@if [ -d modules ]; then \
140+
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
141+
echo "--> Linting $$dir"; \
142+
tflint --chdir=$$dir --init; \
143+
tflint --chdir=$$dir -f compact; \
144+
done; \
145+
fi
146+
81147
lint-examples:
82148
@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
149+
@if [ -d examples ]; then \
150+
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
151+
echo "--> Linting $$dir"; \
152+
tflint --chdir=$$dir --init; \
153+
tflint --chdir=$$dir -f compact; \
154+
done; \
155+
fi
88156

89157
format:
90158
@echo "--> Running terraform fmt"

examples/provider/.terraform.lock.hcl

Lines changed: 46 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/remote_state/.terraform.lock.hcl

Lines changed: 33 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)