Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Terraform plan doesn't handle args file #114

Closed
JordanForeman opened this issue Nov 18, 2019 · 1 comment
Closed

Terraform plan doesn't handle args file #114

JordanForeman opened this issue Nov 18, 2019 · 1 comment

Comments

@JordanForeman
Copy link

JordanForeman commented Nov 18, 2019

Perhaps I'm missing something, but I can't get my terraform plan step to pass for the life of me. I've been trying to better understand the code that executes the plan, but my bash-fu is nearly nonexistent. Here's my setup:

      - name: Terraform Plan
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: 0.12.14
          tf_actions_subcommand: 'plan'
          tf_actions_working_dir: terraform
          args: '-var-file=var/default.tfvars'
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
          AWS_REGION: 'us-east-1'

I would think the relevant part is the args line:

args: '-var-file=var/default.tfvars'

I've tried just about every permutation I can think of

  • args: '-var-file=var/default.tfvars'
  • args: '-var-file=./var/default.tfvars'
  • args: '-var-file=./terraform/var/default.tfvars' (in case the working_dir option isn't respected although I think it should be)
  • args: '-var-file="./var/default.tfvars"' (the docs suggest wrapping in double quotes)
  • etc. etc. etc.

No matter what flavor I try, terraform plan always complains that my variables aren't set (I don't have defaults, I'm relying on my tfvars file).

Error: No value for required variable

  on vars.tf line 9:
   9: variable "my_var" {

The root module input variable "my_var" is not set, and has no default
value. Use a -var or -var-file command line argument to provide a value for
this variable.

Is there an issue with this action (perhaps related to #110 or #109?)? Is there some specific combination of symbols I need for this to work? I'm kind of at a loss.

@sudomateo
Copy link
Contributor

Fixed in #115 which was released in v0.6.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants