hashicorp / terraform-github-actions

Terraform GitHub Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

provide a way to run init with no backend

golonzovsky opened this issue · comments

Would be quite useful to provide a way to run terraform init -backend=false.

This will make it possible to run terrafrom validate without providing sensitive GCP/AWS credentials to remote backends (see hashicorp/terraform#15811 (comment)).

Could be generic extension variable e.g:
initOutput=$(terraform init -input=false $INPUT_TF_ACTIONS_ARGS 2>&1)

Or something more specific in case latter is too broad..

@golonzovsky Why don't you try to use the built-in environment variables like so?

name: 'Terraform Workflow'
on:
  - pull_request
jobs:
  example:
...
      - name: 'Terraform Init'
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: 0.12.13
          tf_actions_subcommand: 'init'
          tf_actions_comment: true
        env:
          TF_CLI_ARGS_init: '-backend=false'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 ...

@sudomateo this is exactly what I needed, thanks a lot!