Skip to main content
1

Create a minimal OpenTofu smoke test

In future steps you will wire up your full infrastructure configuration. First, we suggest you create a minimal root module so you can verify your PR automation setup works end-to-end.
Create a prod/main.tf file to validate your PR automation setup before wiring your full infrastructure repository.
terraform {
  required_version = "~> 1.10.0"
}

resource "null_resource" "smoke_test" {}
Run this flow with tofu init and tofu plan.
This smoke test intentionally skips State Management so you can validate PR automation without handling additional state credentials first.
2

Create digger.yml

Add a digger.yml file at the root of your repository.
projects:
- name: smoke_test
  dir: /path/to/smoke_test
Update dir and project names to match your repository structure.
3

Add GitHub Actions workflow

Create .github/workflows/digger_workflow.yml:
name: Digger Workflow

on:
  workflow_dispatch:
    inputs:
      spec:
        required: true
      run_name:
        required: false

run-name: '${{inputs.run_name}}'

jobs:
  digger-job:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      actions: write
      id-token: write
      pull-requests: write
      issues: read
      statuses: write

    steps:
      - uses: actions/checkout@v4
      - name: ${{ fromJSON(github.event.inputs.spec).job_id }}
        run: echo "job id ${{ fromJSON(github.event.inputs.spec).job_id }}"
      - uses: diggerhq/digger@vLatest
        with:
          digger-spec: ${{ inputs.spec }}
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4

Verify the smoke test in a pull request

Commit your main.tf and digger.yml, push a branch, and open a pull request.Confirm the Digger workflow runs in GitHub Actions and posts a plan comment on the pull request.Then add a PR comment with:
digger apply
Confirm the apply job runs and the apply result is posted back to the pull request.Placeholder: PR plan and apply comments screenshotPlaceholder: GitHub Actions workflow run screenshot
5

Configure production settings next