-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (95 loc) · 3.09 KB
/
tf-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
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
113
on: push
name: Terraform CI
env:
AWS_REGION: us-east-1
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Run Terraform fmt
shell: bash --noprofile --norc -exo pipefail {0}
run: terraform fmt -check
tflint:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Import CI .env file
uses: cardinalby/export-env-action@v1
with:
envFile: '.github/ci-versions.env'
expand: 'true'
- name: Install Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Setup tflint
run: |
wget https://github.com/terraform-linters/tflint/releases/download/${{ env.TFLINT_VERSION }}/tflint_linux_amd64.zip
unzip tflint_linux_amd64.zip
chmod +x tflint
sudo mv tflint /usr/local/bin/tflint
- name: Run tflint
run: tflint .
tfsec:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Import CI .env file
uses: cardinalby/export-env-action@v1
with:
envFile: '.github/ci-versions.env'
expand: 'true'
- name: Install Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Setup tfsec
run: |
wget https://github.com/aquasecurity/tfsec/releases/download/${{ env.TFSEC_VERSION }}/tfsec-linux-amd64
chmod +x tfsec-linux-amd64
sudo mv tfsec-linux-amd64 /usr/local/bin/tfsec
- name: Run tfsec
shell: bash --noprofile --norc -exo pipefail {0}
run: tfsec .
checkov:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: checkov
id: checkov
uses: bridgecrewio/checkov-action@c9e3e20671a02850d20e1b1dae97e34b39ff9b37
with:
quiet: true
framework: terraform
output_format: github_failed_only # optional: the output format, one of: cli, json, junitxml, github_failed_only
download_external_modules: true
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Import CI .env file
uses: cardinalby/export-env-action@v1
with:
envFile: '.github/ci-versions.env'
expand: 'true'
- name: Install Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Validate Terraform code
shell: bash --noprofile --norc -exo pipefail {0}
run: terraform init && terraform validate