Skip to content

Commit 4ec2883

Browse files
authored
Merge pull request #18 from clouddrove/1.0.2
update github-action & License update
2 parents b5651e4 + 295a725 commit 4ec2883

File tree

15 files changed

+379
-197
lines changed

15 files changed

+379
-197
lines changed

.github/workflows/readme.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: '3.x'
1919

2020
- name: 'create readme'
21-
uses: 'clouddrove/github-actions@v8.0'
21+
uses: 'clouddrove/github-actions@v9.0.2'
2222
with:
2323
actions_subcommand: 'readme'
2424
github_token: '${{ secrets.GITHUB}}'
@@ -35,7 +35,7 @@ jobs:
3535
continue-on-error: true
3636

3737
- name: 'push readme'
38-
uses: 'clouddrove/github-actions@v8.0'
38+
uses: 'clouddrove/github-actions@v9.0.2'
3939
continue-on-error: true
4040
with:
4141
actions_subcommand: 'push'

.github/workflows/terraform.yml

Lines changed: 59 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,49 @@
1-
name: 'Terraform GitHub Actions'
1+
name: static-checks
2+
23
on:
34
pull_request:
4-
branches:
5-
- master
65

76
jobs:
8-
fmt:
9-
name: 'terraform fmt'
7+
versionExtract:
8+
name: Get min/max versions
109
runs-on: ubuntu-latest
11-
steps:
12-
- name: 'Checkout'
13-
uses: actions/checkout@master
14-
15-
- name: 'Terraform Format'
16-
uses: 'clouddrove/github-actions@v8.0'
17-
with:
18-
actions_subcommand: 'fmt'
1910

20-
multi_node_non_vpc:
21-
name: 'multi_node_non_vpc'
22-
needs: fmt
23-
runs-on: ubuntu-latest
2411
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
2514

26-
- name: 'Checkout'
27-
uses: actions/checkout@master
28-
29-
- name: 'Configure AWS Credentials'
30-
uses: clouddrove/configure-aws-credentials@v1
31-
with:
32-
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
33-
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
34-
aws-region: us-east-2
35-
36-
- name: 'Terraform init multi_node_non_vpc'
37-
uses: 'clouddrove/github-actions@v8.0'
38-
with:
39-
actions_subcommand: 'init'
40-
tf_actions_working_dir: ./_example/multi_node_non_vpc
41-
42-
- name: 'Terraform validate multi_node_non_vpc'
43-
uses: 'clouddrove/github-actions@v8.0'
44-
with:
45-
actions_subcommand: 'validate'
46-
tf_actions_working_dir: ./_example/multi_node_non_vpc
15+
- name: Terraform min/max versions
16+
id: minMax
17+
uses: clowdhaus/terraform-min-max@main
18+
outputs:
19+
minVersion: ${{ steps.minMax.outputs.minVersion }}
20+
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
4721

48-
- name: 'Terraform plan multi_node_non_vpc'
49-
uses: 'clouddrove/github-actions@v8.0'
50-
with:
51-
actions_subcommand: 'plan'
52-
tf_actions_working_dir: ./_example/multi_node_non_vpc
5322

54-
multi_node_vpc:
55-
name: 'multi_node_vpc'
56-
needs: fmt
23+
versionEvaluate:
24+
name: Evaluate Terraform versions
5725
runs-on: ubuntu-latest
58-
steps:
59-
- name: 'Checkout'
60-
uses: actions/checkout@master
26+
needs: versionExtract
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
version:
31+
- ${{ needs.versionExtract.outputs.minVersion }}
32+
- ${{ needs.versionExtract.outputs.maxVersion }}
33+
directory:
34+
- _example/multi_node_non_vpc
35+
- _example/multi_node_vpc
36+
- _example/single_node_non_vpc
37+
- _example/single_node_vpc
6138

62-
- name: 'Configure AWS Credentials'
63-
uses: clouddrove/configure-aws-credentials@v1
64-
with:
65-
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
66-
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
67-
aws-region: us-east-2
68-
69-
- name: 'Terraform init multi_node_vpc'
70-
uses: 'clouddrove/github-actions@v8.0'
71-
with:
72-
actions_subcommand: 'init'
73-
tf_actions_working_dir: ./_example/multi_node_vpc
74-
75-
- name: 'Terraform validate multi_node_vpc'
76-
uses: 'clouddrove/github-actions@v8.0'
77-
with:
78-
actions_subcommand: 'validate'
79-
tf_actions_working_dir: ./_example/multi_node_vpc
80-
81-
- name: 'Terraform plan multi_node_vpc'
82-
uses: 'clouddrove/github-actions@v8.0'
83-
with:
84-
actions_subcommand: 'plan'
85-
tf_actions_working_dir: ./_example/multi_node_vpc
86-
87-
single_node_non_vpc:
88-
name: 'single_node_non_vpc'
89-
needs: fmt
90-
runs-on: ubuntu-latest
9139
steps:
92-
- name: 'Checkout'
93-
uses: actions/checkout@master
40+
- name: Checkout
41+
uses: actions/checkout@v2
9442

95-
- name: 'Configure AWS Credentials'
96-
uses: clouddrove/configure-aws-credentials@v1
43+
- name: Install Terraform v${{ matrix.version }}
44+
uses: hashicorp/setup-terraform@v1
9745
with:
98-
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
99-
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
100-
aws-region: us-east-2
101-
102-
- name: 'Terraform init for single_node_non_vpc'
103-
uses: 'clouddrove/github-actions@v8.0'
104-
with:
105-
actions_subcommand: 'init'
106-
tf_actions_working_dir: ./_example/single_node_non_vpc
107-
108-
- name: 'Terraform validate for single_node_non_vpc'
109-
uses: 'clouddrove/github-actions@v8.0'
110-
with:
111-
actions_subcommand: 'validate'
112-
tf_actions_working_dir: ./_example/single_node_non_vpc
113-
114-
- name: 'Terraform plan for single_node_non_vpc'
115-
uses: 'clouddrove/github-actions@v8.0'
116-
with:
117-
actions_subcommand: 'plan'
118-
tf_actions_working_dir: ./_example/single_node_non_vpc
119-
120-
single_node_vpc:
121-
name: 'single_node_non_vpc'
122-
needs: fmt
123-
runs-on: ubuntu-latest
124-
steps:
125-
- name: 'Checkout'
126-
uses: actions/checkout@master
46+
terraform_version: ${{ matrix.version }}
12747

12848
- name: 'Configure AWS Credentials'
12949
uses: clouddrove/configure-aws-credentials@v1
@@ -132,53 +52,35 @@ jobs:
13252
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
13353
aws-region: us-east-2
13454

135-
- name: 'Terraform init for single_node_vpc'
136-
uses: 'clouddrove/github-actions@v8.0'
137-
with:
138-
actions_subcommand: 'init'
139-
tf_actions_working_dir: ./_example/single_node_vpc
140-
141-
- name: 'Terraform validate for single_node_vpc'
142-
uses: 'clouddrove/github-actions@v8.0'
143-
with:
144-
actions_subcommand: 'validate'
145-
tf_actions_working_dir: ./_example/single_node_vpc
146-
147-
- name: 'Terraform plan for single_node_vpc'
148-
uses: 'clouddrove/github-actions@v8.0'
149-
with:
150-
actions_subcommand: 'plan'
151-
tf_actions_working_dir: ./_example/single_node_vpc
152-
153-
154-
pre-commit:
155-
name: 'Pre-Commit'
156-
needs:
157-
- fmt
158-
- multi_node_non_vpc
159-
- multi_node_vpc
160-
- single_node_non_vpc
161-
- single_node_vpc
162-
runs-on: ubuntu-latest
163-
steps:
164-
- name: 'Checkout'
165-
uses: actions/checkout@v2.3.4
166-
167-
- name: 'Install Tflint'
55+
- name: Init & validate v${{ matrix.version }}
16856
run: |
169-
curl https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
57+
cd ${{ matrix.directory }}
58+
terraform init
59+
terraform validate
60+
61+
62+
- name: tflint
63+
uses: reviewdog/action-tflint@master
64+
with:
65+
github_token: ${{ secrets.GITHUB }}
66+
working_directory: ${{ matrix.directory }}
67+
fail_on_error: 'true'
68+
filter_mode: 'nofilter'
69+
flags: '--module'
70+
71+
format:
72+
name: Check code format
73+
runs-on: ubuntu-latest
74+
needs: versionExtract
17075

171-
- name: 'Pre-Commit 🔎'
172-
uses: pre-commit/action@v2.0.3
173-
continue-on-error: true
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v2
17479

175-
- name: 'Slack Notification'
176-
uses: clouddrove/action-slack@v2
80+
- name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}
81+
uses: hashicorp/setup-terraform@v1
17782
with:
178-
status: ${{ job.status }}
179-
fields: repo,author
180-
author_name: 'CloudDrove'
181-
env:
182-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
183-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
184-
if: always()
83+
terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}
84+
85+
- name: Check Terraform format changes
86+
run: terraform fmt --recursive

.github/workflows/terratest.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: 'Terratest for multi_node_non_vpc'
2525
if: ${{ github.event.label.name == 'terratest' }}
26-
uses: 'clouddrove/github-actions@v8.0'
26+
uses: 'clouddrove/github-actions@v9.0.2'
2727
with:
2828
actions_subcommand: 'terratest'
2929
tf_actions_working_dir: '_test/multi_node_non_vpc'
@@ -32,8 +32,7 @@ jobs:
3232

3333
- name: 'Terratest for multi_node_vpc'
3434
if: ${{ github.event.label.name == 'terratest' }}
35-
uses: 'clouddrove/github-actions@v8.0'
36-
with:
35+
uses: 'clouddrove/github-actions@v9.0.2
3736
actions_subcommand: 'terratest'
3837
tf_actions_working_dir: '_test/multi_node_vpc'
3938
env:
@@ -42,7 +41,7 @@ jobs:
4241

4342
- name: 'Terratest for single_node_non_vpc'
4443
if: ${{ github.event.label.name == 'terratest' }}
45-
uses: 'clouddrove/github-actions@v8.0'
44+
uses: 'clouddrove/github-actions@v9.0.2'
4645
with:
4746
actions_subcommand: 'terratest'
4847
tf_actions_working_dir: '_test/single_node_non_vpc'
@@ -52,7 +51,7 @@ jobs:
5251

5352
- name: 'Terratest for single_node_vpc'
5453
if: ${{ github.event.label.name == 'terratest' }}
55-
uses: 'clouddrove/github-actions@v8.0'
54+
uses: 'clouddrove/github-actions@v9.0.2'
5655
with:
5756
actions_subcommand: 'terratest'
5857
tf_actions_working_dir: '_test/single_node_vpc'

.github/workflows/tfsec.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: tfsec
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
tfsec:
7+
name: tfsec sarif report
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Clone repo
12+
uses: actions/checkout@master
13+
14+
- name: tfsec
15+
uses: aquasecurity/tfsec-sarif-action@v0.1.0
16+
with:
17+
sarif_file: tfsec.sarif
18+
working_directory: _example
19+
full_repo_scan: true
20+
21+
- name: Upload SARIF file
22+
uses: github/codeql-action/upload-sarif@v1
23+
with:
24+
# Path to SARIF file relative to the root of the repository
25+
sarif_file: tfsec.sarif

0 commit comments

Comments
 (0)