{"id":13505866,"url":"https://github.com/dineshba/tf-summarize","last_synced_at":"2025-05-14T19:03:01.604Z","repository":{"id":43013687,"uuid":"447641855","full_name":"dineshba/tf-summarize","owner":"dineshba","description":"A command-line utility to print the summary of the terraform plan","archived":false,"fork":false,"pushed_at":"2025-01-03T14:40:17.000Z","size":37484,"stargazers_count":589,"open_issues_count":17,"forks_count":41,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-13T13:57:22.631Z","etag":null,"topics":["hacktoberfest","summary","terraform"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dineshba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-13T15:02:16.000Z","updated_at":"2025-04-08T20:42:18.000Z","dependencies_parsed_at":"2023-07-13T05:03:28.057Z","dependency_job_id":"a358af57-28cd-4924-9802-04dfab7ffd47","html_url":"https://github.com/dineshba/tf-summarize","commit_stats":null,"previous_names":["dineshba/terraform-plan-summary"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshba%2Ftf-summarize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshba%2Ftf-summarize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshba%2Ftf-summarize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshba%2Ftf-summarize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dineshba","download_url":"https://codeload.github.com/dineshba/tf-summarize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724587,"owners_count":21151559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","summary","terraform"],"created_at":"2024-08-01T00:01:15.766Z","updated_at":"2025-04-13T13:57:31.846Z","avatar_url":"https://github.com/dineshba.png","language":"Go","funding_links":[],"categories":["Tools","Go"],"sub_categories":["Community providers"],"readme":"## tf-summarize (Terraform Summarizer)\n\n[![Build](https://github.com/dineshba/terraform-plan-summary/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/dineshba/terraform-plan-summary/actions/workflows/build.yml)\n[![goreleaser](https://github.com/dineshba/terraform-plan-summary/actions/workflows/release.yml/badge.svg)](https://github.com/dineshba/terraform-plan-summary/actions/workflows/release.yml)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/dineshba/terraform-plan-summary)\n[![](https://img.shields.io/badge/License-MIT%202.0-blue.svg)](https://github.com/dineshba/tf-summarize/blob/main/LICENSE)\n\n`tf-summarize` is a command-line utility to print the summary of the terraform plan\n\n\u003c!-- TOC --\u003e\n  * [tf-summarize (Terraform Summarizer)](#tf-summarize-terraform-summarizer)\n    * [Demo](#demo)\n    * [Why do we need it ?](#why-do-we-need-it-)\n    * [Install](#install)\n      * [Using Go](#using-go)\n      * [Using Brew](#using-brew)\n      * [Using asdf](#using-asdf)\n      * [Using Docker](#using-docker)\n      * [Using Github action](#using-github-action)\n      * [Download zip in release page](#download-zip-in-release-page)\n      * [Clone and Build Binary](#clone-and-build-binary)\n    * [Usage](#usage)\n    * [Examples](#examples)\n      * [GitHub Actions Workflow](#github-actions-workflow)\n        * [Using setup-tf-summarize action](#using-setup-tf-summarize-action)\n        * [Other approach](#other-approach)\n      * [Codefresh example](#codefresh-example)\n      * [Comment terraform plan summary in PRs](#comment-terraform-plan-summary-in-prs)\n      * [Interactive summary review](#interactive-summary-review)\n    * [Screenshot](#screenshot)\n    * [TODO](#todo)\n\u003c!-- TOC --\u003e\n### Demo\n\n![demo](example/demo.gif)\n\nIf demo is slower for you, please see [examples](#examples) and [screenshot](#screenshot) for more details\n\n### Why do we need it ?\n\n- Most of the time, we make changes to the terraform files or tf-var files and run the plan command. And we precisely know which resources will get affected. In those time, we would like to just see the resource name and it's change.\n- When our plan have more than say 10 changes, we will first see what are the deleted changes, or we will just see the list of resources that get affected.\n\n### Install\n\n#### Using Go\n```sh\ngo install github.com/dineshba/tf-summarize@latest\n```\n\n#### Using Brew\n```sh\nbrew tap thecasualcoder/stable\nbrew install tf-summarize\n```\n\n#### Using asdf\n```sh\nasdf plugin add tf-summarize\nasdf install tf-summarize latest\n```\n\n\u003e See the asdf [plugin source](https://github.com/adamcrews/asdf-tf-summarize#install) for more information.\n\n#### Using Docker\n```sh\ndocker run -v $PWD:/workspace -w /workspace ghcr.io/dineshba/tf-summarize -v # prints version\ndocker run -v $PWD:/workspace -w /workspace ghcr.io/dineshba/tf-summarize tfplan.json\ndocker run -v $PWD:/workspace -w /workspace ghcr.io/dineshba/tf-summarize -tree tfplan.json\n# see example section for more examples\n\n\n# add alias if needed\nalias tf-summarize=\"docker run -v $PWD:/workspace -w /workspace ghcr.io/dineshba/tf-summarize\"\ntf-summarize tfplan.json\n# see example section for more examples\n```\n\n\u003e tf-summarize will accept tfplan directly. Docker based tf-summarize is not having terraform-binary to convert tfplan to json. So it only works with json files.\n\u003e If you want to use with tfplan directly, You can build a base image with terraform (use same version as tfplan created) and have our binary in it.\n\n#### Using Github action\n\nThe below example uses [kishaningithub/setup-tf-summarize](https://github.com/kishaningithub/setup-tf-summarize)\n\n```yaml\nsteps:\n- uses: kishaningithub/setup-tf-summarize@v1\n```\n\nFor more customization options, kindly refer to the [documentation here](https://github.com/kishaningithub/setup-tf-summarize#usage)\n\n#### Download zip in release page\n1. Go to release page [https://github.com/dineshba/terraform-plan-summary/releases](https://github.com/dineshba/terraform-plan-summary/releases)\n2. Download the zip for your OS and unzip it\n3. Copy it to local bin using `cp tf-summarize /usr/local/bin/tf-summarize` or to location which is part of `$PATH`\n4. (For Mac Only) Give access to run if prompted. [Refer here](https://stackoverflow.com/a/19551359/5305962)\n\n#### Clone and Build Binary\n1. Clone this repo\n2. Build binary using `make build` or `go build -o tf-summarize .`\n3. Install it to local bin using `make install` or `cp tf-summarize /usr/local/bin/tf-summarize`\n\n### Usage\n\n```sh\n$ tf-summarize -h\n\nUsage of tf-summarize [args] [tf-plan.json|tfplan]\n\n  -draw\n        [Optional, used only with -tree or -separate-tree] draw trees instead of plain tree\n  -html\n        [Optional] print changes in html format\n  -json\n        [Optional] print changes in json format\n  -json-sum\n        [Optional] print summary in json format\n  -md\n        [Optional, used only with table view] output table as markdown\n  -out string\n        [Optional] write output to file\n  -separate-tree\n        [Optional] print changes in tree format for add/delete/change/recreate changes\n  -tree\n        [Optional] print changes in tree format\n  -v    print version\n```\n\n### Examples\n\n```sh\n# run terraform plan command\nterraform plan -out=tfplan\n\n# provide plan itself directly\ntf-summarize tfplan                           # summary in table format\ntf-summarize -tree tfplan                     # summary in tree format\ntf-summarize -tree -draw tfplan               # summary in 2D tree format\ntf-summarize -json tfplan                     # summary in json format\ntf-summarize -json-sum tfplan                 # summary of changes in json format\ntf-summarize -separate-tree tfplan            # summary in separate tree format\ntf-summarize -separate-tree -draw tfplan      # summary in separate 2D tree format\ntf-summarize -out=summary.md tfplan           # summary in output file instead of stdout\n\n# provide json output from plan\nterraform show -json tfplan | tf-summarize    # summary in table format\nterraform show -json tfplan \u003e output.json\ntf-summarize output.json                      # summary in table format\n```\n\n#### GitHub Actions Workflow\n\n##### Using setup-tf-summarize action\n\nThe below example uses [kishaningithub/setup-tf-summarize](https://github.com/kishaningithub/setup-tf-summarize)\n\n```yaml\nname: Run tf-summarize\n\non:\n  workflow_dispatch:\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - uses: kishaningithub/setup-tf-summarize@v1\n\n      - name: Print tf-summarize version and help\n        run: |\n          tf-summarize -v\n          tf-summarize -h\n```\n\nFor more customization options, kindly refer to the [documentation here](https://github.com/kishaningithub/setup-tf-summarize#usage)\n\n##### Other approach\n\nPlease refer this sample [GitHub actions file](.github/workflows/demo.yml) and the sample runs [here](https://github.com/dineshba/tf-summarize/actions/workflows/demo.yml)\n\n\u003e Note: If you are using `hashicorp/setup-terraform` GitHub action to set up terraform, ensure terraform_wrapper is set to false.\n\n#### Codefresh example\n\nThe below assumes that you have a stage called `show` in your `codefresh.yaml` example\n\nWe need to output the plan to json as there were some strange issues on codefresh when we used the `tfplan` file\n\nA full example is available at [`example/codefresh/codefresh.yaml`](/example/codefresh/codefresh.yaml)\n\n```yaml\n  TerraformPlan:\n    title: Terraform Plan\n    image: hashicorp/terraform:light\n    stage: plan\n    working_directory: \"${{clone}}\"\n    commands:\n      - terraform plan -out=tfplan\n      - terraform show -json tfplan \u003e output.json\n  \n  tfSummarize:\n    title: Show Changes\n    image: ghcr.io/dineshba/tf-summarize\n    stage: show\n    working_directory: \"${{clone}}\"\n    commands:\n      - tf-summarize output.json\n```\n\n\u003e :warning: **Not maintained by [dineshba](https://github.com/dineshba)** : The above example is maintained by [userbradley](https://github.com/userbradley) - Any questions related please tag `@userbradley` on an issue \n\n#### Comment terraform plan summary in PRs\n\nRefer [this example](https://github.com/dineshba/tf-summarize/blob/demo-pr/.github/workflows/demo.yml#L61-L73) to add comments in your PR. Sample [comment](https://github.com/dineshba/tf-summarize/pull/19#issuecomment-1295882938) added by github actions bot.\n\n#### Interactive summary review\n\nYou can use tool [fx](https://github.com/antonmedv/fx) to review the summary fo the terraform change\n```sh\ntf-summarize -json tfplan | fx\n```\n\n### Screenshot\n![screenshot](example/tf-summarize-screenshot.png)\n\n### TODO\n\n- [x] Read terraform state file directly. (Currently need to convert to json and pass it)\n- [ ] Directly run the terraform plan and show the summary\n- [ ] Able to show summary of the current terraform state\n- [x] Include version subcommand in binary\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshba%2Ftf-summarize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdineshba%2Ftf-summarize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshba%2Ftf-summarize/lists"}