Giter Site home page Giter Site logo

cristiango / terraform-plan-comment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from borchero/terraform-plan-comment

0.0 0.0 0.0 401 KB

GitHub Action to post the output of "terraform plan" to a pull request comment.

License: MIT License

JavaScript 9.31% TypeScript 86.13% HCL 4.57%

terraform-plan-comment's Introduction

terraform-plan-comment

GitHub Action to post the output of terraform plan to a pull request comment.

Features

  • Generate a structured, "markdown-native" representation of the plan
    • Obtain a high-level overview via foldable sections
    • Do not lose any information compared to the output of terraform plan
  • Post the plan to pull requests as a "sticky comment"
  • Run as a "native" JavaScript action rather than launching a Docker container
  • Use with or without the Terraform wrapper script provided by hashicorp/setup-terraform

Usage

- name: Setup terraform
  uses: hashicorp/setup-terraform@v3
- name: Initialize
  run: terraform init
- name: Plan
  run: terraform plan -out .planfile
- name: Post PR comment
  uses: borchero/terraform-plan-comment@v1
  with:
    token: ${{ github.token }}
    planfile: .planfile

Example Comments

Collapsed Screenshot 2024-04-30 at 00 07 36
Expanded Screenshot 2024-04-30 at 00 08 22

Parameters

This action provides a few input parameters that allow for customization:

token (required)

Required input parameter to access the GitHub API for posting a pull request comment. Can be provided as ${{ github.token }}, ${{ env.GITHUB_TOKEN }} or some personal access token with appropriate permissions.

If using the workflow-provided token, make sure that your workflow/job has write-permissions to pull requests.

planfile (required)

The path to the planfile generated by terraform plan which holds the information about which changes ought to be applied.

terraform-cmd

The command to execute to call the Terraform binary. Defaults to terraform. You likely don't need to augment this unless terraform cannot be found in the PATH.

working-directory

The directory where the Terraform binary ought to be called. Defaults to $GITHUB_WORKSPACE and must be specified if terraform init has been run in a different directory. Should be specified relative to $GITHUB_WORKSPACE.

Important

planfile must be specified relative to the working directory.

id

A custom identifier for the Terraform execution. This allows to distinguish multiple Terraform runs: each sticky pull request comment is tied to an ID.

repo

The repository to post the comment to. Defaults to the current repository.

terraform-plan-comment's People

Contributors

borchero avatar cristiango avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.