Skip to content

Commit a70f828

Browse files
authored
Update module to aws provider v6 (#19)
* OPS-0 Update to aws v6 * OPS-0 Update pipelines
1 parent a0a1a7d commit a70f828

10 files changed

Lines changed: 265 additions & 131 deletions

File tree

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: "08:00"
9+
timezone: Europe/Berlin

.github/workflows/lint.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
---
2-
3-
# -------------------------------------------------------------------------------------------------
4-
# Job Name
5-
# -------------------------------------------------------------------------------------------------
62
name: lint
73

8-
9-
# -------------------------------------------------------------------------------------------------
10-
# When to run
11-
# -------------------------------------------------------------------------------------------------
124
on:
13-
# Runs on Pull Requests
145
pull_request:
156

16-
17-
# -------------------------------------------------------------------------------------------------
18-
# What to run
19-
# -------------------------------------------------------------------------------------------------
207
jobs:
218
lint:
229
name: "Lint"
@@ -29,17 +16,10 @@ jobs:
2916
- gen
3017

3118
steps:
32-
# ------------------------------------------------------------
33-
# Setup repository
34-
# ------------------------------------------------------------
3519
- name: Checkout repository
36-
uses: actions/checkout@v2
20+
uses: actions/checkout@v5
3721
with:
3822
fetch-depth: 0
39-
40-
# ------------------------------------------------------------
41-
# Lint repository
42-
# ------------------------------------------------------------
4323
- name: "make ${{ matrix.target }}"
4424
run: |
4525
retry() {

.github/workflows/test.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
---
2-
3-
# -------------------------------------------------------------------------------------------------
4-
# Job Name
5-
# -------------------------------------------------------------------------------------------------
62
name: test
73

8-
9-
# -------------------------------------------------------------------------------------------------
10-
# When to run
11-
# -------------------------------------------------------------------------------------------------
124
on:
13-
# Runs on Pull Requests
145
pull_request:
156

16-
17-
# -------------------------------------------------------------------------------------------------
18-
# What to run
19-
# -------------------------------------------------------------------------------------------------
207
jobs:
218
test:
229
name: Test
2310
runs-on: ubuntu-latest
2411
steps:
25-
26-
# ------------------------------------------------------------
27-
# Checkout repository
28-
# ------------------------------------------------------------
2912
- name: Checkout repository
30-
uses: actions/checkout@v2
13+
uses: actions/checkout@v5
3114
with:
3215
fetch-depth: 0
3316

Makefile

Lines changed: 105 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@ ifneq (,)
22
.error This Makefile requires GNU Make.
33
endif
44

5-
.PHONY: help gen lint test _gen-main _gen-examples _gen-modules _lint-files _lint-fmt _pull-tf _pull-tfdocs _pull-fl
5+
.PHONY: help gen lint test _gen-main _gen-examples _gen-modules _lint-files _lint-fmt _lint-json _pull-tf _pull-tfdocs _pull-fl _pull-jl
66

7-
CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
8-
TF_EXAMPLES = $(sort $(dir $(wildcard $(CURRENT_DIR)examples/*/)))
9-
TF_MODULES = $(sort $(dir $(wildcard $(CURRENT_DIR)modules/*/)))
7+
CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
8+
TF_EXAMPLES = $(sort $(dir $(wildcard $(CURRENT_DIR)examples/*/)))
9+
TF_MODULES = $(sort $(dir $(wildcard $(CURRENT_DIR)modules/*/)))
10+
FL_IGNORE_PATHS = .git/,.github/,.terraform/,.idea/
1011

1112
# -------------------------------------------------------------------------------------------------
1213
# Container versions
1314
# -------------------------------------------------------------------------------------------------
14-
TF_VERSION = 1.0.11
15-
TFDOCS_VERSION = 0.16.0-0.34
16-
FL_VERSION = latest-0.8
15+
TF_VERSION = 1.8.5
16+
TFDOCS_VERSION = 0.16.0-0.34
17+
FL_VERSION = latest-0.8
18+
JL_VERSION = 1.6.0-0.14
1719

1820
# -------------------------------------------------------------------------------------------------
19-
# Enable linter (file-lint, terraform fmt)
21+
# Enable linter (file-lint, terraform fmt, jsonlint)
2022
# -------------------------------------------------------------------------------------------------
2123
LINT_FL_ENABLE = 1
2224
LINT_TF_ENABLE = 1
25+
LINT_JL_ENABLE = 1
2326

2427

2528
# -------------------------------------------------------------------------------------------------
@@ -36,7 +39,7 @@ TFDOCS_ARGS = --sort=false
3639
# Default target
3740
# -------------------------------------------------------------------------------------------------
3841
help:
39-
@echo "gen Generate terraform-docs output and replace in all README.md's"
42+
@echo "gen Generate terraform-docs output and replace in README.md's"
4043
@echo "lint Static source code analysis"
4144
@echo "test Integration tests"
4245

@@ -59,6 +62,9 @@ lint:
5962
@if [ "$(LINT_TF_ENABLE)" = "1" ]; then \
6063
$(MAKE) --no-print-directory _lint-fmt; \
6164
fi
65+
@if [ "$(LINT_JL_ENABLE)" = "1" ]; then \
66+
$(MAKE) --no-print-directory _lint-json; \
67+
fi
6268

6369
test: _pull-tf
6470
@$(foreach example,\
@@ -71,7 +77,8 @@ test: _pull-tf
7177
echo "------------------------------------------------------------"; \
7278
echo "# Terraform init"; \
7379
echo "------------------------------------------------------------"; \
74-
if docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" --workdir "$${DOCKER_PATH}" --network host\
80+
if docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" \
81+
--workdir "$${DOCKER_PATH}" --network host \
7582
hashicorp/terraform:$(TF_VERSION) \
7683
init \
7784
-lock=false \
@@ -83,25 +90,29 @@ test: _pull-tf
8390
echo "OK"; \
8491
else \
8592
echo "Failed"; \
86-
docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" --workdir "$${DOCKER_PATH}" --entrypoint=rm \
93+
docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" \
94+
--workdir "$${DOCKER_PATH}" --network none --entrypoint=rm \
8795
hashicorp/terraform:$(TF_VERSION) -rf .terraform/ || true; \
8896
exit 1; \
8997
fi; \
9098
echo; \
9199
echo "------------------------------------------------------------"; \
92100
echo "# Terraform validate"; \
93101
echo "------------------------------------------------------------"; \
94-
if docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" --workdir "$${DOCKER_PATH}" \
102+
if docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" \
103+
--workdir "$${DOCKER_PATH}" --network host \
95104
hashicorp/terraform:$(TF_VERSION) \
96105
validate \
97106
$(ARGS) \
98107
.; then \
99108
echo "OK"; \
100-
docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" --workdir "$${DOCKER_PATH}" --entrypoint=rm \
109+
docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" \
110+
--workdir "$${DOCKER_PATH}" --network none --entrypoint=rm \
101111
hashicorp/terraform:$(TF_VERSION) -rf .terraform/ || true; \
102112
else \
103113
echo "Failed"; \
104-
docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" --workdir "$${DOCKER_PATH}" --entrypoint=rm \
114+
docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t" \
115+
--workdir "$${DOCKER_PATH}" --network none --entrypoint=rm \
105116
hashicorp/terraform:$(TF_VERSION) -rf .terraform/ || true; \
106117
exit 1; \
107118
fi; \
@@ -116,12 +127,56 @@ _gen-main:
116127
@echo "------------------------------------------------------------"
117128
@echo "# Main module"
118129
@echo "------------------------------------------------------------"
119-
@if docker run $$(tty -s && echo "-it" || echo) --rm \
130+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
131+
-v $(CURRENT_DIR):/data \
132+
-e DELIM_START='<!-- TFDOCS_HEADER_START -->' \
133+
-e DELIM_CLOSE='<!-- TFDOCS_HEADER_END -->' \
134+
cytopia/terraform-docs:$(TFDOCS_VERSION) \
135+
terraform-docs-replace --show header markdown tbl --indent 2 --sort README.md; then \
136+
echo "OK"; \
137+
else \
138+
echo "Failed"; \
139+
exit 1; \
140+
fi
141+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
142+
-v $(CURRENT_DIR):/data \
143+
-e DELIM_START='<!-- TFDOCS_PROVIDER_START -->' \
144+
-e DELIM_CLOSE='<!-- TFDOCS_PROVIDER_END -->' \
145+
cytopia/terraform-docs:$(TFDOCS_VERSION) \
146+
terraform-docs-replace --show providers markdown tbl --indent 2 --sort README.md; then \
147+
echo "OK"; \
148+
else \
149+
echo "Failed"; \
150+
exit 1; \
151+
fi
152+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
153+
-v $(CURRENT_DIR):/data \
154+
-e DELIM_START='<!-- TFDOCS_REQUIREMENTS_START -->' \
155+
-e DELIM_CLOSE='<!-- TFDOCS_REQUIREMENTS_END -->' \
156+
cytopia/terraform-docs:$(TFDOCS_VERSION) \
157+
terraform-docs-replace --show requirements markdown tbl --indent 2 --sort README.md; then \
158+
echo "OK"; \
159+
else \
160+
echo "Failed"; \
161+
exit 1; \
162+
fi
163+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
164+
-v $(CURRENT_DIR):/data \
165+
-e DELIM_START='<!-- TFDOCS_INPUTS_START -->' \
166+
-e DELIM_CLOSE='<!-- TFDOCS_INPUTS_END -->' \
167+
cytopia/terraform-docs:$(TFDOCS_VERSION) \
168+
terraform-docs-replace --show inputs markdown doc --indent 2 $(TFDOCS_ARGS) README.md; then \
169+
echo "OK"; \
170+
else \
171+
echo "Failed"; \
172+
exit 1; \
173+
fi
174+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
120175
-v $(CURRENT_DIR):/data \
121-
-e DELIM_START='$(DELIM_START)' \
122-
-e DELIM_CLOSE='$(DELIM_CLOSE)' \
176+
-e DELIM_START='<!-- TFDOCS_OUTPUTS_START -->' \
177+
-e DELIM_CLOSE='<!-- TFDOCS_OUTPUTS_END -->' \
123178
cytopia/terraform-docs:$(TFDOCS_VERSION) \
124-
terraform-docs-replace --sort-by required md README.md; then \
179+
terraform-docs-replace --show outputs markdown tbl --indent 2 --sort README.md; then \
125180
echo "OK"; \
126181
else \
127182
echo "Failed"; \
@@ -135,7 +190,7 @@ _gen-examples:
135190
echo "------------------------------------------------------------"; \
136191
echo "# $${DOCKER_PATH}"; \
137192
echo "------------------------------------------------------------"; \
138-
if docker run $$(tty -s && echo "-it" || echo) --rm \
193+
if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
139194
-v $(CURRENT_DIR):/data \
140195
-e DELIM_START='$(DELIM_START)' \
141196
-e DELIM_CLOSE='$(DELIM_CLOSE)' \
@@ -155,7 +210,7 @@ _gen-modules:
155210
echo "------------------------------------------------------------"; \
156211
echo "# $${DOCKER_PATH}"; \
157212
echo "------------------------------------------------------------"; \
158-
if docker run $$(tty -s && echo "-it" || echo) --rm \
213+
if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
159214
-v $(CURRENT_DIR):/data \
160215
-e DELIM_START='$(DELIM_START)' \
161216
-e DELIM_CLOSE='$(DELIM_CLOSE)' \
@@ -173,12 +228,12 @@ _lint-files: _pull-fl
173228
@echo "################################################################################"
174229
@echo "# File-lint"
175230
@echo "################################################################################"
176-
@docker run $$(tty -s && echo "-it" || echo) --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-cr --text --ignore '.git/,.github/,.terraform/' --path .
177-
@docker run $$(tty -s && echo "-it" || echo) --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-crlf --text --ignore '.git/,.github/,.terraform/' --path .
178-
@docker run $$(tty -s && echo "-it" || echo) --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-trailing-single-newline --text --ignore '.git/,.github/,.terraform/' --path .
179-
@docker run $$(tty -s && echo "-it" || echo) --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-trailing-space --text --ignore '.git/,.github/,.terraform/' --path .
180-
@docker run $$(tty -s && echo "-it" || echo) --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-utf8 --text --ignore '.git/,.github/,.terraform/' --path .
181-
@docker run $$(tty -s && echo "-it" || echo) --rm -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-utf8-bom --text --ignore '.git/,.github/,.terraform/' --path .
231+
@docker run $$(tty -s && echo "-it" || echo) --rm --network none -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-cr --text --ignore '$(FL_IGNORE_PATHS)' --path .
232+
@docker run $$(tty -s && echo "-it" || echo) --rm --network none -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-crlf --text --ignore '$(FL_IGNORE_PATHS)' --path .
233+
@docker run $$(tty -s && echo "-it" || echo) --rm --network none -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-trailing-single-newline --text --ignore '$(FL_IGNORE_PATHS)' --path .
234+
@docker run $$(tty -s && echo "-it" || echo) --rm --network none -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-trailing-space --text --ignore '$(FL_IGNORE_PATHS)' --path .
235+
@docker run $$(tty -s && echo "-it" || echo) --rm --network none -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-utf8 --text --ignore '$(FL_IGNORE_PATHS)' --path .
236+
@docker run $$(tty -s && echo "-it" || echo) --rm --network none -v $(CURRENT_DIR):/data cytopia/file-lint:$(FL_VERSION) file-utf8-bom --text --ignore '$(FL_IGNORE_PATHS)' --path .
182237

183238
_lint-fmt: _pull-tf
184239
@# Lint all Terraform files
@@ -189,8 +244,10 @@ _lint-fmt: _pull-tf
189244
@echo "------------------------------------------------------------"
190245
@echo "# *.tf files"
191246
@echo "------------------------------------------------------------"
192-
@if docker run $$(tty -s && echo "-it" || echo) --rm -v "$(CURRENT_DIR):/t:ro" --workdir "/t" hashicorp/terraform:$(TF_VERSION) \
193-
fmt -recursive -check=true -diff=true -write=false -list=true .; then \
247+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network host \
248+
-v "$(CURRENT_DIR):/t:ro" --workdir "/t" \
249+
hashicorp/terraform:$(TF_VERSION) \
250+
fmt -recursive -check=true -diff=true -write=true -list=true .; then \
194251
echo "OK"; \
195252
else \
196253
echo "Failed"; \
@@ -200,8 +257,26 @@ _lint-fmt: _pull-tf
200257
@echo "------------------------------------------------------------"
201258
@echo "# *.tfvars files"
202259
@echo "------------------------------------------------------------"
203-
@if docker run $$(tty -s && echo "-it" || echo) --rm --entrypoint=/bin/sh -v "$(CURRENT_DIR):/t:ro" --workdir "/t" hashicorp/terraform:$(TF_VERSION) \
204-
-c "find . -name '*.tfvars' -type f -print0 | xargs -0 -n1 terraform fmt -check=true -write=false -diff=true -list=true"; then \
260+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network host \
261+
--entrypoint=/bin/sh -v "$(CURRENT_DIR):/t:ro" --workdir "/t" \
262+
hashicorp/terraform:$(TF_VERSION) \
263+
-c "find . -name '*.tfvars' -type f -print0 | xargs -0 -n1 terraform fmt -check=true -write=true -diff=true -list=true"; then \
264+
echo "OK"; \
265+
else \
266+
echo "Failed"; \
267+
exit 1; \
268+
fi;
269+
@echo
270+
271+
_lint-json: _pull-jl
272+
@# Lint all JSON files
273+
@echo "################################################################################"
274+
@echo "# Jsonlint"
275+
@echo "################################################################################"
276+
@if docker run $$(tty -s && echo "-it" || echo) --rm --network none \
277+
-v "$(CURRENT_DIR):/data:ro" \
278+
cytopia/jsonlint:$(JL_VERSION) \
279+
-t ' ' -i '*.terraform/*' '*.json'; then \
205280
echo "OK"; \
206281
else \
207282
echo "Failed"; \

0 commit comments

Comments
 (0)