{"id":13505865,"url":"https://github.com/datarootsio/tf-profile","last_synced_at":"2025-12-16T00:12:05.507Z","repository":{"id":155525776,"uuid":"610410857","full_name":"datarootsio/tf-profile","owner":"datarootsio","description":"CLI tool to profile Terraform runs, written in Go","archived":false,"fork":false,"pushed_at":"2025-03-15T09:41:14.000Z","size":598,"stargazers_count":157,"open_issues_count":5,"forks_count":3,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-04-01T15:53:48.538Z","etag":null,"topics":["golang","profiling","statistics","terraform","visualization"],"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/datarootsio.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":"2023-03-06T18:08:19.000Z","updated_at":"2025-03-20T06:42:11.000Z","dependencies_parsed_at":"2024-01-03T02:29:21.671Z","dependency_job_id":"2c0b510f-b002-4984-a81e-5aadff234828","html_url":"https://github.com/datarootsio/tf-profile","commit_stats":null,"previous_names":["datarootsio/tf-profile","quintenbruynseraede/tf-profile"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarootsio%2Ftf-profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarootsio%2Ftf-profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarootsio%2Ftf-profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarootsio%2Ftf-profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datarootsio","download_url":"https://codeload.github.com/datarootsio/tf-profile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242657,"owners_count":20907130,"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":["golang","profiling","statistics","terraform","visualization"],"created_at":"2024-08-01T00:01:15.747Z","updated_at":"2025-12-16T00:12:05.448Z","avatar_url":"https://github.com/datarootsio.png","language":"Go","funding_links":[],"categories":["Software Packages","软件包","Go Tools"],"sub_categories":["DevOps Tools","DevOps 工具"],"readme":"# tf-profile\n![Coverage](https://img.shields.io/badge/Coverage-86.2%25-brightgreen)\n\n[![Go Linting, Verification, and Testing](https://github.com/QuintenBruynseraede/tf-profile/actions/workflows/go-fmt-vet-tests.yml/badge.svg?branch=main)](https://github.com/QuintenBruynseraede/tf-profile/actions/workflows/go-fmt-vet-tests.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/QuintenBruynseraede/tf-profile)](https://goreportcard.com/report/github.com/QuintenBruynseraede/tf-profile) [![Go Reference](https://pkg.go.dev/badge/github.com/QuintenBruynseraede/tf-profile.svg)](https://pkg.go.dev/github.com/QuintenBruynseraede/tf-profile)\n\nCLI tool to profile Terraform runs, written in Go.\n\nMain features:\n- Modern CLI ([cobra](https://github.com/spf13/cobra)-based) with autocomplete\n- Read logs straight from your Terraform process (using pipe) or a log file\n- Can generate global stats, resource-level stats or visualizations\n- Provides many levels of granularity and aggregation and customizable outputs\n\nFeatured on: [awesome-go](https://github.com/avelino/awesome-go) | [awesome-terraform](https://github.com/shuaibiyy/awesome-terraform)\n\n\u003e [!WARNING]\n\u003e tf-profile is no longer being actively developed. I do not intend to add new features or support newer versions of Terraform.\n\n\n## Installation\n\n### Brew install\n```bash\n❱ brew tap datarootsio/tf-profile \n❱ brew install tf-profile\n❱ tf-profile --help\ntf-profile is a CLI tool to profile Terraform runs\n\nUsage:\n  tf-profile [command]\n```\n\n### Binary download\n\n- Head over to the releases page ([https://github.com/QuintenBruynseraede/tf-profile/releases](https://github.com/QuintenBruynseraede/tf-profile/releases)) \n- Download the correct binary for your operating system\n- Copy it to a path that is on your `$PATH`. On a Linux system, `/usr/local/bin` is the most common location.\n\n### Using docker\n\nIf you want to try `tf-profile` without installing anything, you can run it using Docker (or similar).\n\n```bash\n❱ cat my_log_file.log | docker run -i qbruynseraede/tf-profile:0.5.0 stats\n\nKey                                Value                                     \nNumber of resources created        1510                                      \n                                                                             \nCumulative duration                36m19s                                    \nLongest apply time                 7m18s                                     \nLongest apply resource             time_sleep.foo[*]                         \n...\n```\n\nOptionally, define an alias:\n\n```bash\n❱ alias tf-profile=docker run -i qbruynseraede/tf-profile:0.5.0\n❱ cat my_log_file.log | tf-profile\n```\n\n### Build from source\n\nThis requires at least version 1.23 of the `go` cli.\n\n```bash\n❱ git clone git@github.com:QuintenBruynseraede/tf-profile.git\n❱ cd tf-profile \u0026\u0026 go build .\n❱ sudo ln -s $(pwd)/tf-profile /usr/local/bin  # Optional: only if you want to run tf-profile from other directories\n❱ tf-profile --help\ntf-profile is a CLI tool to profile Terraform runs\n\nUsage:\n  tf-profile [command]\n```\n\n## Basic usage\n\n`tf-profile` handles input from stdin and from files. These two commands are therefore equivalent:\n\n```bash\n❱ terraform apply -auto-approve | tf-profile table\n❱ terraform apply -auto-approve \u003e log.txt \u0026\u0026 tf-profile table log.txt\n```\n\nFour major commands are supported:\n- [🔗](#tf-profile-stats) `tf-profile stats`: provide general statistics about a Terraform run\n- [🔗](#tf-profile-table) `tf-profile table`: provide detailed, resource-level statistics about a Terraform run\n- [🔗](#tf-profile-filter) `tf-profile filter`: filter logs to include only certain resources\n- [🔗](#tf-profile-graph) `tf-profile graph`: generate a visual overview of a Terraform run.\n\n\n## `tf-profile stats`\n\n`tf-profile stats` is the most basic command. Given a Terraform log, it will only provide high-level statistics.\n\n```bash\n❱ terraform apply -auto-approve \u003e log.txt\n❱ tf-profile stats log.txt\n\nKey                                Value    \n-----------------------------------------------------------------                       \nNumber of resources in configuration        1510                            \n                                                                   \nCumulative duration                         36m19s                          \nLongest apply time                          7m18s                           \nLongest apply resource                      time_sleep.foo[*]               \n\nResources marked for operation Create       892\nResources marked for operation None         18\nResources marked for operation Replace      412      \n    \nResources in state AllCreated               800                             \nResources in state Created                  695                             \nResources in state Started                  15        \n    \nResources in desired state                  1492 out of 1510 (98.8%)\nResources not in desired state              18 out of 1510 (0.01%)\n                                                                \nNumber of top-level modules                 13                              \nLargest top-level module                    module.core[2]                  \nSize of largest top-level module            170                             \nDeepest module                              module.core[2].module.role[47]  \nDeepest module depth                        2                               \nLargest leaf module                         module.dbt[4]                   \nSize of largest leaf module                 40  \n```\n\nFor more information, refer to the [reference](./docs/stats.md) for the `stats` command.\n\n## `tf-profile table`\n\n`tf-profile table` will parse a log and provide per-resource metrics.\n\n```bash\n❱ terraform apply -auto-approve \u003e log.txt\n❱ tf-profile table log.txt\n\nresource              n  tot_time  modify_started  modify_ended  desired_state  operation  final_state  \naws_ssm_parameter.p6  1  0s        6               7             Created        Replace    Created      \naws_ssm_parameter.p1  1  0s        7               5             Created        Replace    Created      \naws_ssm_parameter.p3  1  0s        5               6             Created        Replace    Created      \naws_ssm_parameter.p4  1  0s        /               1             NotCreated     Destroy    NotCreated   \naws_ssm_parameter.p5  1  0s        4               4             Created        Modify     Created      \naws_ssm_parameter.p2  1  0s        /               /             Created        None       Created      \n```\n\nFor a full description of the options, see the [reference](./docs/table.md) page.\n\n## `tf-profile filter`\n`tf-profile filter` filters logs to include only certain resources. Wildcards are supported to filter on multiple resources.\n\n```sh\n❱ tf-profile filter \"module.*.null_resource.*\" log.txt\n\n  # module.mod1.null_resource.foo will be created\n  + resource \"null_resource\" \"foo\" {\n    ...\n    }\n\n  # module.mod2.null_resource.bar will be created\n  + resource \"null_resource\" \"bar\" {\n    ...\n    }\n\nmodule.mod1.null_resource.foo: Creating...\nmodule.mod2.null_resource.bar: Creating...\nmodule.mod1.null_resource.foo: Creation complete after 1s [id=foo]\nmodule.mod2.null_resource.bar: Creation complete after 1s [id=bar]\n```\n\nFor a full description of the options, see the [reference](./docs/filter.md) page.\n\n\n\n## `tf-profile graph`\n\n`tf-profile graph` is used to visualize your terraform logs. It generates a [Gantt](https://en.wikipedia.org/wiki/Gantt_chart)-like chart that shows in which order resources were created. `tf-profile` does not actually create the final image, but generates a script file that [Gnuplot](https://en.wikipedia.org/wiki/Gnuplot) understands. \n\n```bash\n❱ tf-profile graph my_log.log --out graph.png --size 2000,1000 | gnuplot\n```\n\n![graph.png](https://github.com/QuintenBruynseraede/tf-profile/blob/main/.github/graph.png?raw=true)\n\n_Disclaimer:_ Terraform's logs do not contain any absolute timestamps. We can only derive the order in which resources started and finished their modifications. Therefore, the output of `tf-profile graph` gives only a general indication of _how long_ something actually took. In other words: the X axis is meaningless, apart from the fact that it's monotonically increasing.\n\n\n## Screenshots\n\n![stats.png](https://github.com/QuintenBruynseraede/tf-profile/blob/main/.github/stats.png?raw=true)\n\n![table.png](https://github.com/QuintenBruynseraede/tf-profile/blob/main/.github/table.png?raw=true)\n\n![graph2.png](https://github.com/QuintenBruynseraede/tf-profile/blob/main/.github/graph2.png?raw=true)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatarootsio%2Ftf-profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatarootsio%2Ftf-profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatarootsio%2Ftf-profile/lists"}