Skip to content

Pararius/action-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

456850c · Feb 3, 2025

History

92 Commits
Oct 24, 2023
Feb 3, 2025
Nov 11, 2021
Nov 11, 2021
Nov 12, 2021
Aug 11, 2021
Oct 31, 2022
Oct 31, 2022
Feb 3, 2025
Feb 3, 2025
Feb 3, 2025

Repository files navigation

Terraform

GitHub Action to automate Terraform workflows.

Usage

- uses: Pararius/action-terraform@0.0.9
  name: Terraform
  with:
    # Google credentials, required for accessing state bucket
    google_credentials: ''

    # Location of terraform manifests, relative to the current working directory
    # Default: ./
    terraform_directory: ''

    # Whether to run `terraform apply` as last step
    # Default: 'false'
    terraform_do_apply: ''

    # Whether to run `terraform destroy` (`terraform_do_apply` and
    # `terraform_do_destroy` can not both be true)
    # Default: 'false'
    terraform_do_destroy: ''

    # Whether to (try to) lock the state during plan/apply. Recommended when
    # terraform_do_apply or terraform_do_destroy is set to 'true'
    # Default: 'false'
    terraform_lock: ''

    # Limit the number of concurrent operations during plan/apply
    # Default: '10'
    terraform_parallelism: ''

    # Whether to (try to) refresh the state during plan/apply. Only to be used
    # when state's so large and mostly static that refreshing it everytime is a
    # bit overkill.
    # Default: 'false'
    terraform_refresh: ''

    # A multiline string containing targets that should be passed to terraform
    # (one per line)
    terraform_targets: ''

    # A JSON string containing variables that should be passed to terraform.
    # For example: {"my_var": "my_value"}
    terraform_variables: ''

    # The name of the workspace that resources should be applied in. When left
    # empty, the terraform default is used
    terraform_workspace: ''

Example

Only run terraform plan, without locking the workspace

- uses: Pararius/action-terraform@0.0.9
  name: Terraform
  with:
    google_credentials: ${{ secrets.YOUR_SECRET }}
    terraform_directory: ./terraform/
    terraform_do_apply: false

Also run terraform apply, locking the workspace

- uses: Pararius/action-terraform@0.0.9
  name: Terraform
  with:
    google_credentials: ${{ secrets.YOUR_SECRET }}
    terraform_directory: ./terraform/
    terraform_do_apply: true
    terraform_lock: true