dflook /terraform-github-actions

GitHub actions for Terraform and OpenTofu

★ 996⑂ 174👁 9⑃ 243● 161▤ 89◈ 48
PythonCreated 2020-07-06
996
stars
174
forks
9
watchers
243
prs
161
issues
89
releases
48
discussions

README

Terraform and OpenTofu GitHub Actions !release!job runs

This is a suite of Terraform and OpenTofu related GitHub Actions that can be used together to build effective Infrastructure as Code workflows.

GitHub Actions are a way to make automated workflows that trigger when events occur on your GitHub repository, using a YAML file that lives in your repo.
These actions can be used to easily perform Terraform or OpenTofu tasks as part of your workflow.

 Actions

See the documentation for the available actions:

| Terraform                                                         | OpenTofu                                                |
|-------------------------------------------------------------------|---------------------------------------------------------|
| dflook/terraform-plan                           | dflook/tofu-plan                           |
| dflook/terraform-apply                         | dflook/tofu-apply                         |
| dflook/terraform-output                       | dflook/tofu-output                       |
| dflook/terraform-remote-state           | dflook/tofu-remote-state           |
| dflook/terraform-validate                   | dflook/tofu-validate                   |
| dflook/terraform-fmt-check                 | dflook/tofu-fmt-check                 |
| dflook/terraform-fmt                             | dflook/tofu-fmt                             |
| dflook/terraform-check                         | dflook/tofu-check                         |
| dflook/terraform-new-workspace         | dflook/tofu-new-workspace         |
| dflook/terraform-destroy-workspace | dflook/tofu-destroy-workspace |
| dflook/terraform-destroy                     | dflook/tofu-destroy                     |
| dflook/terraform-version                     | dflook/tofu-version                     |
| dflook/terraform-unlock-state           | dflook/tofu-unlock-state           |
| dflook/terraform-test                           | dflook/tofu-test                           |
| dflook/terraform-refresh                     | dflook/tofu-refresh                     |

 Example Usage

These actions can be added as steps to your own workflow files.
GitHub reads workflow files from .github/workflows/ within your repository.
See the Workflow documentation for details on writing workflows.

Here are some examples of how the actions can be used together in workflows.

 Terraform plan PR approval

Terraform plans typically need to be reviewed by a human before being applied.
Fortunately, GitHub has a well established method for requiring human reviews of changes - a Pull Request.

We can use PRs to safely plan and apply infrastructure changes.


    


You can make GitHub enforce this using branch protection, see the dflook/terraform-apply action for details.

In this example we use two workflows:

 plan.yaml

This workflow runs on changes to a PR branch. It generates a Terraform plan and attaches it to the PR as a comment.

yaml
name: Create terraf

Top issues

Discussions

Latest release

v3.1.3 v3.1.3 2026-11-10
All the terraform actions in this repository are released as one.
Use the actions as part of a GitHub Actions workflow, e.g:

yaml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7

    - uses: dflook/[email protected]
      with:
        path: my-terraform-config


You can specify an action version as:
- @v3.1.3 to use exactly this release
- @v3.1 to use the latest patch release for this specific minor version
- @v3 to use the latest patch release for this specific major version

 Changes

 Security
- The debug log no longer includ

Snapshot: 2026-11-11T15:31:17Z · Data license Apache-2.0 · JSON