terraform-github-actions

terraform-check action

This is one of a suite of Terraform related actions - find them at dflook/terraform-github-actions.

Check for drift in Terraform managed resources. This action runs the terraform plan command, and fails the build if any changes are required. This is intended to run on a schedule to notify if manual changes to your infrastructure have been made.

Inputs

Outputs

Environment Variables

Example usage

This example workflow runs every morning and will fail if there has been unexpected changes to your infrastructure.

name: Check for infrastructure drift

on:
  schedule:
    - cron:  "0 8 * * *"

jobs:
  check_drift:
    runs-on: ubuntu-latest
    name: Check for drift of Terraform configuration
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Check
        uses: dflook/terraform-check@v1
        with:
          path: my-terraform-configuration

This example executes a run step only if there are changes to apply.

name: Check for infrastructure drift

on:
  schedule:
    - cron:  "0 8 * * *"

jobs:
  check_drift:
    runs-on: ubuntu-latest
    name: Check for drift of Terraform configuration
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Check
        uses: dflook/terraform-check@v1
        id: check
        with:
          path: my-terraform-configuration

      - name: Changes detected
        if: $
        run: echo "There are outstanding changes to apply"