diff --git a/.github/config/.tflint.hcl b/.github/config/.tflint.hcl index 2f507004..d17f0e80 100644 --- a/.github/config/.tflint.hcl +++ b/.github/config/.tflint.hcl @@ -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 } + diff --git a/.github/workflows/terraform_workflow.yml b/.github/workflows/terraform_workflow.yml index b230941b..4fc3b537 100644 --- a/.github/workflows/terraform_workflow.yml +++ b/.github/workflows/terraform_workflow.yml @@ -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 }} diff --git a/.github/workflows/tf-lint.yml b/.github/workflows/tf-lint.yml index 7b470894..4b14127b 100644 --- a/.github/workflows/tf-lint.yml +++ b/.github/workflows/tf-lint.yml @@ -2,7 +2,6 @@ name: tf-lint on: workflow_call: - # Secrets can be defined to use during workflow call. secrets: GITHUB: required: true @@ -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 \ No newline at end of file + - 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 }}