{"id":13490848,"url":"https://github.com/cycloidio/inframap","last_synced_at":"2025-05-14T02:05:00.077Z","repository":{"id":37211545,"uuid":"277649384","full_name":"cycloidio/inframap","owner":"cycloidio","description":"Read your tfstate or HCL to generate a graph specific for each provider, showing only the resources that are most important/relevant.","archived":false,"fork":false,"pushed_at":"2025-01-21T16:00:47.000Z","size":13418,"stargazers_count":1838,"open_issues_count":46,"forks_count":100,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-10T16:39:20.663Z","etag":null,"topics":["aws","diagram","flexibleengine","go","golang","graph","hcl","openstack","terraform","tfstate"],"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/cycloidio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2020-07-06T21:09:17.000Z","updated_at":"2025-04-29T09:11:37.000Z","dependencies_parsed_at":"2024-01-03T02:28:39.855Z","dependency_job_id":"fec34eb6-f53c-44a3-a2b7-ec1ac41612d8","html_url":"https://github.com/cycloidio/inframap","commit_stats":{"total_commits":248,"total_committers":6,"mean_commits":"41.333333333333336","dds":0.342741935483871,"last_synced_commit":"d2527460e633bd9940237baf87395ac1b8b20605"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Finframap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Finframap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Finframap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Finframap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycloidio","download_url":"https://codeload.github.com/cycloidio/inframap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052692,"owners_count":22006716,"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":["aws","diagram","flexibleengine","go","golang","graph","hcl","openstack","terraform","tfstate"],"created_at":"2024-07-31T19:00:51.494Z","updated_at":"2025-05-14T02:05:00.053Z","avatar_url":"https://github.com/cycloidio.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/inframap-logo_color-RGB.png\" width=\"150\"\u003e\n\u003c/p\u003e\n\n# InfraMap\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/cycloidio/inframap)](https://pkg.go.dev/github.com/cycloidio/inframap)\n[![AUR package](https://repology.org/badge/version-for-repo/aur/inframap.svg)](https://repology.org/project/inframap/versions)\n[![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/inframap.json\u0026query=$.versions.stable\u0026label=homebrew)](https://formulae.brew.sh/formula/inframap)\n[![Join the chat at https://gitter.im/cycloidio/inframap](https://badges.gitter.im/cycloidio/inframap.svg)](https://gitter.im/cycloidio/inframap)\n\nRead your tfstate or HCL to generate a graph specific for each provider, showing only the\nresources that are most important/relevant.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/inframap.png\" width=\"400\"\u003e\n\u003c/p\u003e\n\n## Cloud Providers\n\nWe support **all** cloud providers, but we have some (listed below) that we have specific logic that allows\nus to better represent information that comes from these providers.\n\nFor the other providers the resulting representation will simply be all resources present without any simplification or refinement.\n\nFor TFState generations we are limited to versions 3 and 4.\n\n| Provider | State | HCL |  Grouping\u003csup\u003e1\u003c/sup\u003e | External Nodes\u003csup\u003e2\u003c/sup\u003e | IAM\u003csup\u003e3\u003c/sup\u003e |\n|:--:|:--:|:--:|:--:|:--:|:--:|\n| \u003cimg alt=\"AWS\" src=\"docs/aws.png\" width=\"50\"\u003e | :heavy_check_mark: | :heavy_check_mark: | [WIP](https://github.com/cycloidio/inframap/issues/6) | :heavy_check_mark: | :heavy_multiplication_x: (https://github.com/cycloidio/inframap/issues/11)|\n| \u003cimg alt=\"Google\" src=\"docs/google-cloud.svg\" width=\"50\"\u003e | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |\n| \u003cimg alt=\"Azure\" src=\"docs/azure.svg\" width=\"50\"\u003e | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |\n| \u003cimg alt=\"OpenStack\" src=\"docs/Openstack-vertical-small.png\" width=\"50\"\u003e | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |\n| \u003cimg alt=\"FlexibleEngine\" src=\"docs/flexibleengine.png\" width=\"50\"\u003e | :heavy_check_mark: | :heavy_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |\n\n1. **Grouping**: Group elements that belong to the same group like VPCs or regions\n2. **External Nodes**: Show the ingress of the Nodes if any\n3. **IAM**: Connections based on IAM (Identity Access Management)\n\n## Installation\n\n### Stable\n\nTo install the latest release of Inframap, you can pick one of this methods:\n  * pull the latest release from the [Releases](https://github.com/cycloidio/inframap/releases/) page\n  * pull the latest docker [image](https://hub.docker.com/r/cycloid/inframap) from the Docker hub\n  * use your Linux package manager (only [AUR](https://aur.archlinux.org/packages/inframap) at the moment)\n\n### Development\n\nYou can build and install with the latest sources, you will enjoy the new features and bug fixes. It uses Go Modules (1.13+)\n\n```shell\n$ git clone https://github.com/cycloidio/inframap\n$ cd inframap\n$ go mod download\n$ make build\n```\n\n### Install via brew\n\nIf you're macOS user and using [Homebrew](https://brew.sh/), you can install via brew command:\n\n```sh\n$ brew install inframap\n```\n\n## Usage\n\nThe `inframap --help` will show you the basics.\n\n[![asciicast](https://asciinema.org/a/347600.svg)](https://asciinema.org/a/347600)\n\nThe most important subcommands are:\n\n* `generate`: generates the graph from STDIN or file.\n* `prune`: removes all unnecessary information from the state or HCL (not supported yet) so it can be shared without any security concerns\n\n### Example\n\nVisualizing with [dot](https://graphviz.org/download/)\n\n```shell\ninframap generate state.tfstate | dot -Tpng \u003e graph.png\n```\n\nor from the terminal itself with [graph-easy](https://github.com/ironcamel/Graph-Easy)\n\n```shell\ninframap generate state.tfstate | graph-easy\n```\n\nor from HCL\n\n```shell\ninframap generate config.tf | graph-easy\n```\n\nor HCL module\n\n```shell\ninframap generate ./my-module/ | graph-easy\n```\n\nusing docker image (assuming that your Terraform files are in the working directory)\n\n```shell\ndocker run --rm -v ${PWD}:/opt cycloid/inframap generate /opt/terraform.tfstate\n```\n\nor if you use docker and want to have the images generated already, the docker image has the `graphviz` lib installed:\n\n```shell\ndocker run --rm -v ${PWD}:/opt --entrypoint \"/bin/ash\" cycloid/inframap -c './inframap generate /opt/PATH_TO_HCL_STATE | dot -Tpng \u003e /opt/graph.png'\n```\n\nand the generated image will be on `$PWD/graph.png`\n\n\n**Note:** InfraMap will guess the type of the input (HCL or TFState) by validating if it's a JSON and if it fails then we fallback\nto HCL (except if you send a directory on args, the it'll use HCL directly), to force one specific type you can use `--hcl` or `--tfstate` flags.\n\n## How is it different to `terraform graph`\n\n[Terraform Graph](https://www.terraform.io/docs/commands/graph.html) outputs a dependency graph of all the resources on the tfstate/HCL. We try to go one step further,\nby trying to make it human-readable.\n\nIf the provider is not supported, the output will be closer to the Terraform Graph version (without displaying provider / variable nodes)\n\nTaking https://github.com/cycloid-community-catalog/stack-magento/ as a reference this is the difference in output:\n\nWith `terraform graph`:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/terraformgraph.svg\" width=\"400\"\u003e\n\u003c/p\u003e\n\nWith `inframap generate ./terraform/module-magento/ | dot -Tpng \u003e inframap.png`:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/inframap.png\" width=\"400\"\u003e\n\u003c/p\u003e\n\nWith `inframap generate --connections=false ./terraform/module-magento/ | dot -Tpng \u003e inframapconnections.png`:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/inframapconnections.png\" width=\"400\"\u003e\n\u003c/p\u003e\n\nWith `inframap generate ./terraform/module-magento/ --raw | dot -Tpng \u003e inframapraw.png`:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/inframapraw.png\" width=\"400\"\u003e\n\u003c/p\u003e\n\n## How does it work?\n\nFor each provider, we support specific types of connections; we have a static list of resources that can be\nnodes or edges. Once we identify the edges, we try to create one unique edge from the resources they connect.\n\nFor a state file, we rely on the `dependencies` key (for the \u003c0.13 we replace all `depends_on` for `dependencies` so we support them) and, for HCL we rely on interpolation to create the base graph one which we then\napply specific provider logic if supported. If not supported, then basic graph is returned.\n\n## FAQ\n\n### Why is my Graph generated empty?\n\nIf a graph is returned empty, it means that we support one of the providers you are using on your HCL/TFState but we do\nnot recognize any connection or relevant node.\n\nTo show the configuration without any InfraMap applied logic you can use the `--raw` flag logic and print everything that we read.\nIf it works, it would be good to try to know why it was empty before so we can take a look\nat it as it could potentially be an issue on InfraMap (open an issue if you want us to take a look).\n\nBy default unconnected nodes are removed, you can use `--clean=false` to prevent that.\n\n### Does InfraMap support Terraform backends ?\n\nTerraform allows users to use `backends` (S3, Google Cloud Storage, Swift, etc.) in order to store the `terraform.state`. We currently do not support graph generation from `tfstate` stored in such backends. As mentioned in this [issue](https://github.com/cycloidio/inframap/issues/44), it is possible to play around `stdin/out` to generate graph from Terraform backends.\n\n| backend | command                                                                  |\n|---------|--------------------------------------------------------------------------|\n| S3      | `aws s3 cp s3://bucket/path/to/your/file.tfstate - \\| inframap generate` |\n| GCS     | `gsutil cat gs://bucket/path/to/your/file.tfstate \\| inframap generate`  |\n\nA general solution is also to just use `terraform state pull \\| inframap generate` as it'll pull the state from whichever backend is actually stored\n\n## License\n\nPlease see the [MIT LICENSE](https://github.com/cycloidio/inframap/blob/master/LICENSE) file.\n\n## Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Meet Cycloid\n\n[Cycloid](https://www.cycloid.io/) is a hybrid cloud DevOps collaboration platform providing end-to-end frameworks to accelerate and industrialize software delivery.\n\nAs of now, we have three open-source tools:\n\n* [TerraCognita](https://github.com/cycloidio/terracognita): Read from your existing cloud providers and generate IaC in Terraform \n* [InfraMap](https://github.com/cycloidio/inframap): Reads .tfstate or HCL to generate a graph specific for each provider\n* [TerraCost](https://github.com/cycloidio/terracost): Cloud cost estimation for Terraform in the CLI\n\n...and the functionality of each is also embedded in our DevOps solution, which you can find out more about [here](https://www.cycloid.io/hybrid-cloud-devops-platform).\n","funding_links":[],"categories":["Go","Tools","Diagrams as code","Repositories"],"sub_categories":["Community providers","Build systems"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycloidio%2Finframap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycloidio%2Finframap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycloidio%2Finframap/lists"}