Configuration

Complete reference for all inputs and outputs the Terraform Plan GitHub Action accepts.


This section covers everything you can configure in the Terraform Plan GitHub Action.

Quick Reference

Inputs

InputRequiredDefaultDescription
planfileYes-Path to your Terraform plan file
terraform-cmdNoterraformCommand for calling Terraform (useful for Terragrunt/OpenTofu)
working-directoryNo.Directory where Terraform should run
tokenNogithub.tokenGitHub token for posting comments
headerNo-Custom header for multi-environment setups
aws-regionNo-AWS region to display in the comment

Outputs

OutputDescription
markdownRaw markdown of the formatted plan
empty'true' if no changes, 'false' if changes exist

Detailed Reference

For complete documentation on each input and output, including:

  • Usage examples for every parameter
  • Best practices for multi-environment setups
  • How to use outputs for conditional logic
  • Permission requirements
  • Working with Terragrunt and OpenTofu

See the Inputs & Outputs reference.

Common Patterns

Simple usage (just the required input):

- uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: tfplan.binary

With region display:

- uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: tfplan.binary
    aws-region: us-east-1

With working directory:

- uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: tfplan.binary
    working-directory: ./infrastructure
    aws-region: us-east-1

Multi-environment with headers:

- uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: dev-plan.binary
    header: "Dev Environment"
    working-directory: ./environments/dev
    aws-region: us-east-1

- uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: prod-plan.binary
    header: "Production Environment"
    working-directory: ./environments/prod
    aws-region: eu-west-1

Using Terragrunt:

- uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: tfplan.binary
    terraform-cmd: terragrunt
    working-directory: ./infrastructure

Conditional logic with outputs:

- name: Post Terraform Plan
  id: tf-plan
  uses: towardsthecloud/terraform-plan-pr-commenter@v1
  with:
    planfile: tfplan.binary

- name: Check for changes
  if: steps.tf-plan.outputs.empty == 'false'
  run: echo "Infrastructure changes detected!"