Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahmadnassri/action-terraform-report
Updates Pull Requests with visual diff of Terraform Plan changes
https://github.com/ahmadnassri/action-terraform-report
action github terraform
Last synced: 1 day ago
JSON representation
Updates Pull Requests with visual diff of Terraform Plan changes
- Host: GitHub
- URL: https://github.com/ahmadnassri/action-terraform-report
- Owner: ahmadnassri
- License: mit
- Created: 2020-08-15T02:53:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-19T15:32:27.000Z (about 1 month ago)
- Last Synced: 2024-12-18T17:11:47.573Z (9 days ago)
- Topics: action, github, terraform
- Language: JavaScript
- Homepage:
- Size: 3.59 MB
- Stars: 37
- Watchers: 5
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action: Terraform Pull Request Report Generator
Updates Pull Requests with visual diff of Terraform Plan changes
[![license][license-img]][license-url]
[![release][release-img]][release-url]
[![semantic][semantic-img]][semantic-url]## Usage
``` yaml
name: terraform-planon:
pull_request:jobs:
terraform-plan:
runs-on: ubuntu-lateststeps:
- 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
remove-stale-reports: true
```> **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 |
| `show-plan` | ❌ | `true` | include the terraform plan view in the final output? |
| `show-diff` | ❌ | `false` | include the diff view in the final output? |
| `remove-stale-reports` | ❌ | `false` | remove report comments for old commits? |
| `custom-header` | ❌ | `:robot: Terraform Report` | The header text for the github comment |## Examples
| Pull Request Comment *(default)* |
|----------------------------------|
| ![][1] || Pull Request Comment *(Plan)* |
|-------------------------------|
| ![][2] || Pull Request Comment *(Diff)* |
|-------------------------------|
| ![][3] |[1]: ./docs/1.png
[2]: ./docs/2.png
[3]: ./docs/3.png----
> Author: [Ahmad Nassri](https://www.ahmadnassri.com/) •
> Twitter: [@AhmadNassri](https://twitter.com/AhmadNassri)[license-url]: LICENSE
[license-img]: https://badgen.net/github/license/ahmadnassri/action-terraform-report[release-url]: https://github.com/ahmadnassri/action-terraform-report/releases
[release-img]: https://badgen.net/github/release/ahmadnassri/action-terraform-report[semantic-url]: https://github.com/ahmadnassri/action-terraform-report/actions?query=workflow%3Arelease
[semantic-img]: https://badgen.net/badge/📦/semantically%20released/blue