Skip to content

Commit

Permalink
Merge pull request #9 from clouddrove/1.0.5
Browse files Browse the repository at this point in the history
fix static-checks
  • Loading branch information
yadavprakash committed Jun 15, 2022
2 parents 1ba47d8 + 98ff35d commit de3feee
Showing 1 changed file with 64 additions and 22 deletions.
86 changes: 64 additions & 22 deletions .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
name: 'Terratest GitHub Actions'
name: static-checks

on:
pull_request:
branches:
- master
types: [labeled]

jobs:
Terratest:
name: 'Terratest'
versionExtract:
name: Get min/max versions
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@main
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}


versionEvaluate:
name: Evaluate Terraform versions
runs-on: ubuntu-latest
needs: versionExtract
strategy:
fail-fast: false
matrix:
version:
- ${{ needs.versionExtract.outputs.minVersion }}
- ${{ needs.versionExtract.outputs.maxVersion }}
directory:
- _example/

steps:
- name: Checkout
uses: actions/checkout@v2

- name: 'Checkout'
uses: actions/checkout@v2.3.4
- name: Install Terraform v${{ matrix.version }}
uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ matrix.version }}

- name: 'Configure AWS Credentials'
uses: clouddrove/configure-aws-credentials@v1
Expand All @@ -21,20 +49,34 @@ jobs:
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }}
aws-region: us-east-2

- name: 'Terratest'
uses: 'clouddrove/github-actions@v9.0.2'
- name: Init & validate v${{ matrix.version }}
run: |
cd ${{ matrix.directory }}
terraform init
terraform validate
terraform plan -input=false -no-color
- name: tflint
uses: reviewdog/action-tflint@master
with:
actions_subcommand: 'terratest'
if: ${{ github.event.label.name == 'terratest' }}
tf_actions_working_dir: '_test'
github_token: ${{ secrets.GITHUB }}
working_directory: ${{ matrix.directory }}
fail_on_error: 'true'
filter_mode: 'nofilter'
flags: '--module'

format:
name: Check code format
runs-on: ubuntu-latest
needs: versionExtract

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}
uses: hashicorp/setup-terraform@v1
with:
status: ${{ job.status }}
fields: repo,author
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}

- name: Check Terraform format changes
run: terraform fmt --recursive

0 comments on commit de3feee

Please sign in to comment.