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

Request -var and -vars-file #163

Open
mimyrtek opened this issue Mar 15, 2022 · 1 comment
Open

Request -var and -vars-file #163

mimyrtek opened this issue Mar 15, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@mimyrtek
Copy link

I would like to request the ability to pass in -var or -vars file to the runs , if possible

@jpogran jpogran added the enhancement New feature or request label May 18, 2022
@aimerib
Copy link

aimerib commented Nov 19, 2022

This would indeed be useful. For my specific use case, since I only had a handful of vars, I passed them via the env key and I no longer use a vars file. If you have tens or hundreds of vars, this might not work for you, but for me this worked, so leaving it here for others:

      - name: Terraform Apply
        if: github.ref == 'refs/heads/main' && github.event_name == 'push'
        run: terraform apply -auto-approve -input=false
        env:
          TF_VAR_do_token: "${{ env.DO_TOKEN }}"
          TF_VAR_ssh_fingerprint: "${{ env.SSH_FINGERPRINT }}"

and inside my .tf file:

variable "do_token" {}
variable "ssh_fingerprint" {}

provider "digitalocean" {
  token = var.do_token
}

resource "digitalocean_droplet" "do-droplet" {
  image         = "ubuntu-22-10-x64"
  name          = "droplet"
  region        = "nyc3"
  size            = "s-1vcpu-1gb"
  ssh_keys   = [var.ssh_fingerprint]
}

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

No branches or pull requests

3 participants