Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grantbirki/terratrash-action
A GitHub Action to discard (trash) unwanted Terraform output for humans - CI wrapper for the base Ruby Gem
https://github.com/grantbirki/terratrash-action
ci formatting github-actions terraform utility
Last synced: 13 days ago
JSON representation
A GitHub Action to discard (trash) unwanted Terraform output for humans - CI wrapper for the base Ruby Gem
- Host: GitHub
- URL: https://github.com/grantbirki/terratrash-action
- Owner: GrantBirki
- License: mit
- Created: 2024-03-04T23:48:04.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-05T02:14:29.000Z (8 months ago)
- Last Synced: 2024-10-05T08:22:20.149Z (about 1 month ago)
- Topics: ci, formatting, github-actions, terraform, utility
- Language: Shell
- Homepage: https://github.com/GrantBirki/terratrash
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terratrash-action 🗑️
This action is a simple wrapper around the [terratrash](https://github.com/GrantBirki/terratrash) Ruby Gem. It is designed to be used in a GitHub Actions workflow to clean up Terraform output text with ease to make it more human readable.
## Usage
```yaml
# you must run the checkout action first
- name: checkout
uses: actions/checkout@v4# somewhere in your workflow you might run terraform plan or apply (example here)
# this step shows an example of a terraform plan command where we pipe the output to a file
- name: Terraform plan
id: plan
continue-on-error: true
run: |
set -o pipefail
terraform plan -no-color -compact-warnings | tee terraform-output.txt# now you can use the terratrash-action to clean up the output
- name: terratrash
uses: GrantBirki/[email protected] # replace with the latest version
with:
input_file_path: terraform-output.txt
output_file_path: terraform-output-fmt.txt# finally you can print the formatted output, save it as an artifact, post it as a PR comment, etc.
- name: Print formatted output
run: cat terraform-output-fmt.txt
```## Inputs
Check out the [`action.yml`](./action.yml) file for the most up-to-date list of inputs that this Action supports.
## branch-deploy compatibility
If you are using the [`github/branch-deploy`](https://github.com/github/branch-deploy) Action with Terraform and want some cleaned up Terraform deployment comments, here are some details that you might find useful:
- Live Example: [related workflow code](https://github.com/the-hideout/cloudflare/blob/0e579405af0422e80ae76f3e085001fd528045ec/.github/workflows/branch-deploy.yml#L60-L94) - [template file for pull request comments](https://github.com/the-hideout/cloudflare/blob/0e579405af0422e80ae76f3e085001fd528045ec/.github/deployment_message.md)
- [branch deploy custom comment docs](https://github.com/github/branch-deploy/blob/1f6516ef5092890ce75d9e97ca7cbdb628e38bdd/docs/custom-deployment-messages.md)