Skip to content

Terraform Pull Request Report Generator

Actions
Updates Pull Requests with visual diff of Terraform Plan changes
v5.1.1
Latest
Star (41)

GitHub Action: Terraform Pull Request Report Generator

Updates Pull Requests with visual diff of Terraform Plan changes

license release

Usage

name: terraform-plan

on:
  pull_request:

jobs:
  terraform-plan:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - uses: hashicorp/setup-terraform@v3
        with:
          terraform_wrapper: false

      - run: terraform init
      - run: terraform plan -lock=false -out terraform.plan

      # generate plain output
      - run: terraform show -no-color terraform.plan > terraform.text

      # generate json output
      - run: terraform show -json terraform.plan > terraform.json

      - uses: ahmadnassri/action-terraform-report@v4
        with:
          # tell the action the plan outputs
          terraform-text: ${{ github.workspace }}/terraform.text
          terraform-json: ${{ github.workspace }}/terraform.json

Note: Ensure terraform_wrapper is set to false to better capture the output into a file (or use your own method)

Inputs

input required default description
terraform-text - path to the file resulting from the output of terraform show /path/to/plan
terraform-json - path to the file resulting from the output of terraform show -json /path/to/plan
github-token github.token The GitHub token used to post comments on pull requests
custom-header :robot: *Terraform Report* custom header text for the github comment
custom-footer - custom footer text for the github comment
show-header true include header in the comment?
show-footer true include footer in the comment?
show-plan true include the terraform plan view in the comment?
show-diff false include the diff view in the comment?
remove-stale-reports true remove report comments for old commits?
show-no-changes true post a comment even when there are no changes in the terraform plan?

Examples

Pull Request Comment (default)
Pull Request Comment (Plan)
Pull Request Comment (Diff)

Author: Ahmad Nassri

Terraform Pull Request Report Generator is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Updates Pull Requests with visual diff of Terraform Plan changes
v5.1.1
Latest

Terraform Pull Request Report Generator is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.