Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle cache and init internally #161

Open
lukasz-mitka opened this issue Apr 4, 2023 · 2 comments
Open

Handle cache and init internally #161

lukasz-mitka opened this issue Apr 4, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@lukasz-mitka
Copy link

Instead of requiring users to setup cache and call init just do it as part of this action.

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

    - uses: terraform-linters/setup-tflint@v3
      name: Setup TFLint
      with:
        tflint_version: v0.44.1

    - name: Show version
      run: tflint --version

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

Could become

    - name: Setup TFLint
      uses: terraform-linters/setup-tflint@v4
      with:
        tflint_version: v0.44.1
@bendrucker
Copy link
Member

cache

Doable, PR welcome

token

Not sure about this. This is not the same situation as setup-terraform, which can accept Terraform credentials and write them somewhere where they will only influence Terraform.

Accomplishing this means writing out GITHUB_TOKEN to $GITHUB_ENV. Which then affects other programs potentially using that environment variable.

I'd only be inclined to do something like this by default with an alternative env var, e.g. TFLINT_GITHUB_TOKEN, which will require an upstream change to the CLI and won't be backwards compatible with any existing versions.

version - just run it

Doesn't seem like a suitable default. Printing debug logs on which version was downloaded, sure, and maybe even an output based on that. setup-terraform doesn't call terraform version. And tflint --version outputs human-readable text, not JSON, so it's not suitable for programmatic usage.

@bendrucker bendrucker added the enhancement New feature or request label Apr 7, 2023
@bendrucker
Copy link
Member

I'd only be inclined to do something like this by default with an alternative env var

Clarifying: it probably makes sense to offer this as an input, just not on by default. At least not without a major version bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants