Skip to content

Commit b124ee1

Browse files
authored
Merge pull request #21 from clouddrove/1.0.2
fix github-action
2 parents 54226ed + 8141472 commit b124ee1

File tree

9 files changed

+319
-124
lines changed

9 files changed

+319
-124
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@v7.0'
21+
uses: 'clouddrove/github-actions@v9.0.2'
2222
with:
2323
actions_subcommand: 'readme'
2424
github_token: '${{ secrets.GITHUB}}'
@@ -34,7 +34,7 @@ jobs:
3434
continue-on-error: true
3535

3636
- name: 'push readme'
37-
uses: 'clouddrove/github-actions@v7.0'
37+
uses: 'clouddrove/github-actions@v9.0.2'
3838
continue-on-error: true
3939
with:
4040
actions_subcommand: 'push'

.github/workflows/terraform.yml

Lines changed: 56 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,46 @@
1-
name: 'Terraform GitHub Actions'
1+
name: static-checks
2+
23
on:
34
pull_request:
4-
branches:
5-
- master
5+
66
jobs:
7-
fmt:
8-
name: 'terraform fmt'
7+
versionExtract:
8+
name: Get min/max versions
99
runs-on: ubuntu-latest
10-
steps:
11-
- name: 'Checkout'
12-
uses: actions/checkout@v2.3.4
13-
14-
- name: 'Terraform Format'
15-
uses: 'clouddrove/github-actions@v7.0'
16-
with:
17-
actions_subcommand: 'fmt'
1810

19-
DNS:
20-
name: 'DNS'
21-
needs: fmt
22-
runs-on: ubuntu-latest
2311
steps:
24-
- name: 'Checkout'
25-
uses: actions/checkout@v2.3.4
12+
- name: Checkout
13+
uses: actions/checkout@v2
2614

27-
- name: 'Configure AWS Credentials'
28-
uses: clouddrove/configure-aws-credentials@v1
29-
with:
30-
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }}
31-
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
32-
aws-region: us-east-2
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 }}
3321

34-
- name: 'Terraform init for generate certificate dns'
35-
uses: 'clouddrove/github-actions@v7.0'
36-
with:
37-
actions_subcommand: 'init'
38-
tf_actions_working_dir: ./_example/generate-certificate-dns
39-
40-
- name: 'Terraform validate for generate certificate dns'
41-
uses: 'clouddrove/github-actions@v7.0'
42-
with:
43-
actions_subcommand: 'validate'
44-
tf_actions_working_dir: ./_example/generate-certificate-dns
4522

46-
- name: 'Terraform plan for generate certificate dns'
47-
uses: 'clouddrove/github-actions@v7.0'
48-
with:
49-
actions_subcommand: 'plan'
50-
tf_actions_working_dir: ./_example/generate-certificate-dns
51-
Email:
52-
name: 'Email'
53-
needs: fmt
23+
versionEvaluate:
24+
name: Evaluate Terraform versions
5425
runs-on: ubuntu-latest
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/
35+
5536
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
5639

57-
- name: 'Checkout'
58-
uses: actions/checkout@v2.3.4
40+
- name: Install Terraform v${{ matrix.version }}
41+
uses: hashicorp/setup-terraform@v1
42+
with:
43+
terraform_version: ${{ matrix.version }}
5944

6045
- name: 'Configure AWS Credentials'
6146
uses: clouddrove/configure-aws-credentials@v1
@@ -64,55 +49,34 @@ jobs:
6449
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
6550
aws-region: us-east-2
6651

67-
- name: 'Terraform init for generate certificate email'
68-
uses: 'clouddrove/github-actions@v7.0'
69-
with:
70-
actions_subcommand: 'init'
71-
tf_actions_working_dir: ./_example/generate-certificate-email
72-
73-
- name: 'Terraform validate for generate certificate email'
74-
uses: 'clouddrove/github-actions@v7.0'
75-
with:
76-
actions_subcommand: 'validate'
77-
tf_actions_working_dir: ./_example/generate-certificate-email
52+
- name: Init & validate v${{ matrix.version }}
53+
run: |
54+
cd ${{ matrix.directory }}
55+
terraform init
56+
terraform validate
7857
79-
- name: 'Terraform plan for generate certificate email'
80-
uses: 'clouddrove/github-actions@v7.0'
58+
- name: tflint
59+
uses: reviewdog/action-tflint@master
8160
with:
82-
actions_subcommand: 'plan'
83-
tf_actions_working_dir: ./_example/generate-certificate-email
84-
85-
pre-commit:
86-
name: 'Pre-Commit'
87-
needs:
88-
- fmt
89-
- DNS
90-
- Email
61+
github_token: ${{ secrets.GITHUB }}
62+
working_directory: ${{ matrix.directory }}
63+
fail_on_error: 'true'
64+
filter_mode: 'nofilter'
65+
flags: '--module'
66+
67+
format:
68+
name: Check code format
9169
runs-on: ubuntu-latest
92-
steps:
93-
- name: 'Checkout'
94-
uses: actions/checkout@v2.3.4
95-
96-
- name: 'Install Tflint'
97-
run: |
98-
curl https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
99-
100-
- name: 'Pre-Commit 🔎'
101-
uses: pre-commit/action@v2.0.3
102-
continue-on-error: true
70+
needs: versionExtract
10371

72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v2
10475

105-
- name: 'Pre-Commit 🔎'
106-
uses: pre-commit/action@v2.0.3
107-
continue-on-error: true
108-
109-
- name: 'Slack Notification'
110-
uses: clouddrove/action-slack@v2
76+
- name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}
77+
uses: hashicorp/setup-terraform@v1
11178
with:
112-
status: ${{ job.status }}
113-
fields: repo,author
114-
author_name: 'CloudDrove'
115-
env:
116-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
117-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
118-
if: always()
79+
terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}
80+
81+
- name: Check Terraform format changes
82+
run: terraform fmt --recursive

.github/workflows/terratest.yml

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

2424
- name: 'Terratest Generate Certificate DNS'
2525
if: ${{ github.event.label.name == 'terratest' }}
26-
uses: 'clouddrove/github-actions@v7.0'
26+
uses: 'clouddrove/github-actions@v9.0.2'
2727
with:
2828
actions_subcommand: 'terratest'
2929
tf_actions_working_dir: _test/generate-certificate-dns
@@ -58,7 +58,7 @@ jobs:
5858

5959
- name: 'Terratest Generate Certificate Email'
6060
if: ${{ github.event.label.name == 'terratest' }}
61-
uses: 'clouddrove/github-actions@v7.0'
61+
uses: 'clouddrove/github-actions@v9.0.1'
6262
with:
6363
actions_subcommand: 'terratest'
6464
tf_actions_working_dir: _test/generate-certificate-email

.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)