-
Notifications
You must be signed in to change notification settings - Fork 23
46 lines (44 loc) · 1.47 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
env:
TF_IMAGE: hashicorp/terraform:1.0.3
TFLINT_IMAGE: ghcr.io/terraform-linters/tflint:v0.30.0
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Run terraform init + validate check over entire repo
run: |-
docker run --rm -t -v "${PWD}:/tf" \
-e AWS_DEFAULT_REGION="xxx" -e NOMAD_ADDR="xxx" -e VAULT_ADDR="xxx" \
--entrypoint sh \
"${TF_IMAGE}" \
-c "find . \
-not -path '*/\.*' \
-type f -iname '*.tf' \
-exec dirname {} \; \
| sort | uniq | \
xargs -I{} sh -c \"echo Checking {}... && (cd {} && terraform init -backend=false && terraform validate)\""
- name: Run tflint check over entire repo
run: |-
docker run --rm -t -v "${PWD}:/data:ro" \
--entrypoint sh \
"${TFLINT_IMAGE}" \
-c "find . \
-not -path '*/\.*' \
-type f -iname '*.tf' \
-exec dirname {} \; \
| sort | uniq | \
xargs -I{} sh -c \"echo Checking {}... && (cd {} && tflint)\""
- name: Run terraform fmt check over entire repo
run: docker run --rm -t -v "${PWD}:/tf:ro" "${TF_IMAGE}" fmt -check=true -recursive /tf/modules/
- name: Run terraform-docs check over entire repo
run: ./inout.sh check