Skip to content

Missing documentation on how to pass variables to terraform #35

@christian-roggia

Description

@christian-roggia

There is currently no documentation on how to pass variables to terraform.

Additionally, it seems like setting environment variables TF_VAR have no effect:

name: Production CI

env:
  TF_VAR_image_tag: ${{ github.sha }}

on:
  push:
    branches: [ master ]

jobs:
  provision:
    runs-on: ubuntu-latest

    steps:
    - name: Clone the repository code
      uses: actions/checkout@v2

    - name: Setup the Terraform CLI
      uses: hashicorp/setup-terraform@v1
      with:
        cli_config_credentials_token: ${{ secrets.TF_CREDENTIALS }}
      env:
        TF_VAR_image_tag: ${{ github.sha }}

    - name: Initialize the Terraform working directory
      working-directory: ./terraform
      id: init
      run: terraform init
      env:
        TF_VAR_image_tag: ${{ github.sha }}

    - name: Apply the Terraform execution plan
      working-directory: ./terraform
      id: plan
      run: terraform apply -auto-approve -no-color
      env:
        TF_VAR_image_tag: ${{ github.sha }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions