forked from lablabs/terraform-aws-eks-external-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (95 loc) · 3.33 KB
/
main.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Terraform validation
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
TERRAFORM_DOCS_VERSION: "v0.15.0"
TFLINT_VERSION: "v0.25.0"
TFSEC_VERSION: "v0.39.6"
jobs:
terraform-validation:
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-python@v2
name: "SETUP: Python"
- uses: actions/[email protected]
id: cache-terraform-docs
name: "CACHE: terraform-docs"
with:
path: |
~/terraform-docs/bin/
key: ${{ runner.os }}-terraform_docs-${{ env.TERRAFORM_DOCS_VERSION }}
restore-keys: |
${{ runner.os}}-terraform_docs-
- shell: bash
name: "INSTALL: terraform-docs"
if: steps.cache-terraform-docs.output.cache-hit != 'true'
run: |
wget https://github.com/terraform-docs/terraform-docs/releases/download/${{ env.TERRAFORM_DOCS_VERSION }}/terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz
tar xvzf terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz
mkdir -p ~/terraform-docs/bin/
install terraform-docs ~/terraform-docs/bin/
- shell: bash
name: "SETUP: terraform-docs path"
run: echo '~/terraform-docs/bin/' >> $GITHUB_PATH
- uses: actions/checkout@v2
name: Checkout source code
- uses: actions/cache@v2
id: cache-pre-commit-dependencies
name: "CACHE: pip and pre-commit dependencies"
with:
path: |
~/.cache/pre-commit
~/.cache/pip
key: ${{ runner.os }}-pip-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pip-pre-commit-
- uses: actions/cache@v2
id: cache-tflint
name: "CACHE: tflint"
with:
path: |
~/tflint/bin/
key: ${{ runner.os }}-tflint-${{ env.TFLINT_VERSION }}
restore-keys: |
${{ runner.os }}-tflint-
- shell: bash
name: "INSTALL: detect-secrets"
run: |
pip install detect-secrets
- shell: bash
name: "INSTALL: tflint"
if: steps.cache-tflint.outputs.cache-hit != 'true'
run: |
wget https://github.com/terraform-linters/tflint/releases/download/${{ env.TFLINT_VERSION }}/tflint_linux_amd64.zip
unzip tflint_linux_amd64.zip
mkdir -p ~/tflint/bin/
install tflint ~/tflint/bin/
- shell: bash
name: "SETUP: tflint path"
run: echo '~/tflint/bin/' >> $GITHUB_PATH
- uses: actions/cache@v2
id: cache-tfsec
name: "CACHE: tfsec"
with:
path: |
~/tfsec/bin/
key: ${{ runner.os }}-tfsec-${{ env.TFSEC_VERSION }}
restore-keys: |
${{ runner.os }}-tfsec-
- shell: bash
name: "INSTALL: tfsec"
if: steps.cache-tfsec.outputs.cache-hit != 'true'
run: |
wget https://github.com/tfsec/tfsec/releases/download/${{ env.TFSEC_VERSION }}/tfsec-linux-amd64
mkdir -p ~/tfsec/bin/
install tfsec-linux-amd64 ~/tfsec/bin/
- shell: bash
name: "SETUP: tfsec path"
run: echo '~/tfsec/bin/' >> $GITHUB_PATH
- uses: pre-commit/[email protected]
name: "RUN: pre-commit"
env:
AWS_DEFAULT_REGION: "eu-central-1"