Skip to content

Commit

Permalink
Merge branch 'master' into internal_357
Browse files Browse the repository at this point in the history
  • Loading branch information
VishwajitNagulkar authored Aug 24, 2023
2 parents 0bbae71 + 999cfb0 commit 61e9261
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 47 deletions.
15 changes: 8 additions & 7 deletions .github/config/.tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
// https://github.com/terraform-linters/tflint/blob/master/docs/guides/config.md
config {
module = false
force = false
force = false
}

plugin "aws" {
enabled = true
version = "0.21.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
enabled = true
version = "0.21.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
deep_check = false
}

rule "aws_instance_invalid_type" {
enabled = false
enabled = true
}

rule "aws_instance_previous_type" {
enabled = false
enabled = true
}

rule "terraform_required_providers" {
enabled = false
enabled = true
}

2 changes: 1 addition & 1 deletion .github/workflows/terraform_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:

- name: Install GCP CLI
if: ${{ inputs.provider == 'gcp' }}
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v1
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.PROJECT_ID }}
Expand Down
73 changes: 34 additions & 39 deletions .github/workflows/tf-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: tf-lint
on:
workflow_call:
# Secrets can be defined to use during workflow call.
secrets:
GITHUB:
required: true
Expand All @@ -12,42 +11,38 @@ jobs:
tflint:
runs-on: ubuntu-latest

# Checkout the repository to the GitHub Actions runner
steps:
- uses: actions/checkout@v3
name: Checkout source code

# Action to add tflint plugin based in OS
- uses: actions/cache@v3
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ubuntu-latest-tflint-${{ hashFiles('.tflint.hcl') }}

#Setting up terraform lint
- uses: terraform-linters/setup-tflint@v3
name: Setup TFLint
with:
tflint_version: v0.44.1
github_token: ${{ secrets.GITHUB }}

# Added tflint config to check tflint additional rules
- uses: terraform-linters/tflint-load-config-action@v1
name: Setup tflint-config
with:
source-repo: clouddrove/github-shared-workflows
source-path: .github/config/.tflint.hcl

# Verfiy the installed tflint version.
- name: Show version
run: tflint --version

- name: init lint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

# command to check tf lint in terraform code.
- name: Run lint
run: tflint --recursive --color --force -f compact
- uses: actions/checkout@v3
name: Checkout source code

- uses: actions/cache@v3
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ubuntu-latest-tflint-${{ hashFiles('.tflint.hcl') }}

- uses: terraform-linters/setup-tflint@v3
name: Setup TFLint
with:
tflint_version: v0.44.1
github_token: ${{ secrets.GITHUB }}

- uses: terraform-linters/tflint-load-config-action@v1
name: Setup tflint-config
with:
source-repo: clouddrove/github-shared-workflows
source-path: .github/config/.tflint.hcl
source-ref: master

- name: Show version
run: tflint --version

- name: init lint
run: tflint --init
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Run lint
run: tflint --recursive --color --force -f compact
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit 61e9261

Please sign in to comment.