Skip to content

robertdebock/terraform-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Terraform action

A GitHub action to run HashiCorp Terraform commands.

Inputs

action

The command to run, for example: validate, init (default), plan or apply. Have a look at terraform --help for details.

directory

The directory where the Terraform files can be found. This defaults to ./, but can be set to i.e. ./example.

Example usage

Here is a default configuration that run only terraform init.

---
on:
  - push

jobs:
  build:
    runs-on: ubuntu-20.04
    steps:
      - name: checkout
        uses: actions/checkout@v2
      - name: terraform
        uses: robertdebock/terraform-action@1.1.4

To use another action on a specific terraform directory, change this example to you needs:

---
on:
  - push

jobs:
  build:
    runs-on: ubuntu-20.04
    steps:
      - name: checkout
        uses: actions/checkout@v2
      - name: terraform init
        uses: robertdebock/terraform-action@1.1.4
        with:
          action: init
          directory: ./example
      - name: terraform validate
        uses: robertdebock/terraform-action@1.1.4
        with:
          action: validate
          directory: ./example
      - name: terraform plan
        uses: robertdebock/terraform-action@1.1.4
        with:
          action: plan
          directory: ./example
      - name: terraform apply
        uses: robertdebock/terraform-action@1.1.4
        with:
          action: apply
          directory: ./example
        env:
          TF_CLI_ARGS: "-input=false -auto-approve"

About

A GitHub action to run HashiCorp Terraform commands.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published