This section covers everything you can configure in the Terraform Plan GitHub Action.
Quick Reference
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
planfile | Yes | - | Path to your Terraform plan file |
terraform-cmd | No | terraform | Command for calling Terraform (useful for Terragrunt/OpenTofu) |
working-directory | No | . | Directory where Terraform should run |
token | No | github.token | GitHub token for posting comments |
header | No | - | Custom header for multi-environment setups |
aws-region | No | - | AWS region to display in the comment |
Outputs
| Output | Description |
|---|---|
markdown | Raw 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!"
Related
- Usage Examples - Complete workflow examples
- Install Guide - Setup and troubleshooting