{"id":13590721,"url":"https://github.com/Ianyliu/blast-radius-fork","last_synced_at":"2025-04-08T14:31:37.408Z","repository":{"id":55619186,"uuid":"522708402","full_name":"Ianyliu/blast-radius-fork","owner":"Ianyliu","description":"Interactive visualizations of Terraform dependency graphs using d3.js","archived":false,"fork":true,"pushed_at":"2025-03-06T21:24:37.000Z","size":1875,"stargazers_count":44,"open_issues_count":13,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-06T22:26:15.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://28mm.github.io/blast-radius-docs/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"28mm/blast-radius","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ianyliu.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}},"created_at":"2022-08-08T21:11:21.000Z","updated_at":"2025-03-06T21:23:28.000Z","dependencies_parsed_at":"2023-02-09T22:45:19.029Z","dependency_job_id":null,"html_url":"https://github.com/Ianyliu/blast-radius-fork","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ianyliu%2Fblast-radius-fork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ianyliu%2Fblast-radius-fork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ianyliu%2Fblast-radius-fork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ianyliu%2Fblast-radius-fork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ianyliu","download_url":"https://codeload.github.com/Ianyliu/blast-radius-fork/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247860665,"owners_count":21008330,"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":[],"created_at":"2024-08-01T16:00:49.837Z","updated_at":"2025-04-08T14:31:36.625Z","avatar_url":"https://github.com/Ianyliu.png","language":"JavaScript","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eBlast Radius \u003ci\u003eFork\u003c/i\u003e\u003c/h1\u003e\n\n[terraform]: https://www.terraform.io/\n[examples]: https://28mm.github.io/blast-radius-docs/\n[docs]: https://28mm.github.io/blast-radius-docs/\n\n_Blast Radius Fork_ is an interactive visualizer for [Terraform](https://www.terraform.io/) based off of \n[_Blast Radius_](https://28mm.github.io/blast-radius/), \nwhich hasn't been actively maintained since 2020. \n\nIt is not guaranteed to be bug free. Please feel free to contribute!\n\n----------------------------------\n\n## Table of Contents \n- [Table of Contents](#table-of-contents)\n- [Usage](#usage)\n- [Prerequisites for Local Use](#prerequisites-for-local-use)\n- [Local Quickstart](#local-quickstart)\n- [Docker Quickstart](#docker-quickstart)\n- [Kubernetes Quickstart](#kubernetes-quickstart)\n  - [Kubernetes Prerequisites](#kubernetes-prerequisites)\n  - [Start the App on Kubernetes](#start-the-app-on-kubernetes)\n  - [Kubernetes Debugging/Helpful Commands](#kubernetes-debugginghelpful-commands)\n- [Parameters](#parameters)\n- [Embedded Figures](#embedded-figures)\n- [How It Works](#how-it-works)\n- [Motivation](#motivation)\n- [What's Different](#whats-different)\n- [Future Implementations \\\u0026 Possible Functionalities](#future-implementations--possible-functionalities)\n- [Further Reading](#further-reading)\n- [Other Tools to Check Out](#other-tools-to-check-out)\n\n----------------------------------\n\n## Usage\n\nUse _Blast Radius_ to:\n\n* __Learn__ about *Terraform* or one of its providers through real [examples][]\n* __Visualize__ your infrastructure\n* __Reason__ about relationships between resources and evaluate changes to them\n* __Interact__ with the diagram below (and many others) [in the docs][examples]\n* __Compare__ different infrastructure \n\n![screenshot](doc/blastradius-interactive.png)\n\n## Prerequisites for Local Use\n\n* [Python](https://www.python.org/) 3.7+\n* [Graphviz](https://www.graphviz.org/)\n* [Terraform](https://www.terraform.io/) (if you do not have generated Terraform DOT graphs yet)\n\n\u003e __Note:__ For macOS you can `brew install graphviz`\n \n\u003e __Note:__ For Docker usage prerequisites, see [Docker.md](Docker.md)\n\n## Local Quickstart\n\nThe fastest way to run with *Blast Radius* is to install it with\n`pip` to your pre-existing environment:\n\n```sh\npython -m pip install git+https://github.com/Ianyliu/blast-radius-fork\n```\nor \n```sh\npython3 -m pip install git+https://github.com/Ianyliu/blast-radius-fork\n```\n\nYou can then run Blast Radius from the command line:\n\n```sh\nblast-radius --serve \n```\n\nIf you want to create graphs for an initialized *Terraform* directory, you can just start *Blast Radius* within the \ninitialized *Terraform*\ndirectory:\n\n```\nblast-radius --serve /path/to/terraform/directory\n```\n\nAnd you will shortly be rewarded with a browser link http://127.0.0.1:5000/.\n\n[//]: # (You can specify the host and/or port number with the `--host` and --port` flags:)\n\n[//]: # ()\n[//]: # (```)\n\n[//]: # (blast-radius --serve /path/to/terraform/directory --host 127.0.0.1 --port=8080)\n\n[//]: # (```)\n\n\nNote: If you do not have an initialized Terraform directory but have the DOT script (the output of the `terraform graph` command, note that this is not the same as a JSON file or state graph). You can either copy and paste the DOT script into the text input field or uploaded the DOT script file.\n\nOther ways to run it include [Docker](#docker-quickstart) and [Kubernetes](#kubernetes-quickstart)\n\n## Docker Quickstart\n\n[privileges]: https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities\n[overlayfs]: https://wiki.archlinux.org/index.php/Overlay_filesystem\n\nLaunch a container for a local directory with *Blast Radius* running:\n\nsh, zsh, bash, etc. (Linux recommended):\n```sh\ndocker run --rm -it -p 5000:5000 \\\n  -v $(pwd):/data:ro \\\n  --security-opt apparmor:unconfined \\\n  --cap-add=SYS_ADMIN \\\n  ianyliu/blast-radius-fork\n```\n\nWindows PowerShell:\n```powershell\ndocker run --rm -it -p 5000:5000 `\n  -v ${pwd}:/data:ro `\n  --security-opt apparmor:unconfined `\n  --cap-add=SYS_ADMIN `\n  ianyliu/blast-radius-fork\n```\n\nNote: If you have spaces in your directory then you may have to change `-v ${pwd}:/data:ro` to `-v \"${pwd}:/data:ro\"` instead.\n\nA slightly more customized variant of this is also available as an example\n[docker-compose.yml](./Docker/docker-compose.yml) usecase for Workspaces.\n\nFor more details on Docker usage, see [Docker.md](Docker.md)\n\n## Kubernetes Quickstart\n\nLaunch *Kubernetes* locally using Minikube, Kubernetes, and Kubectl:\n\n### Kubernetes Prerequisites\n\u003cdetails\u003e\n\u003csummary\u003e\u003c/summary\u003e\n\n* Docker (or another container or virtual machine manager) \n* Kubectl: https://kubernetes.io/docs/tasks/tools/\n* Minikube: https://minikube.sigs.k8s.io/docs/start/\n\u003c/details\u003e\n\n### Start the App on Kubernetes\n\u003cdetails\u003e\n\u003csummary\u003e\u003c/summary\u003e\n\n1. Start Minikube  \n```minikube start```\n2. Change directories to the file containing the 2 YAML files (*k8-blast-radius-deployment.yaml* and \n3. *k8-blast-radius-service.yaml* apply the YAML configuration files to the default namespace (or any other namespace)  \n```\nkubectl apply -f k8-blast-radius-deployment.yaml\nkubectl apply -f k8-blast-radius-service.yaml\n```\nAccess the app  \n```\nminikube service  k8-blast-radius-service\n```\n\u003c/details\u003e\n\n### Kubernetes Debugging/Helpful Commands\n\u003cdetails\u003e\n\u003csummary\u003e\u003c/summary\u003e\n\n* To check the state of your pods (containers), execute the following:  \n```kubectl get pods```  \n* To see more details about a pod. (Replace ```\u003cnamespace\u003e``` and ```\u003cpod\u003e``` with the corresponding values)  \n```kubectl describe -n=\u003cnamespace\u003e pod/\u003cpod\u003e```\n* To see logs for a pod (replace corresponding values)  \n```kubectl logs -f -n=\u003cns\u003e \u003cpod\u003e```\n* The most helpful tool is probably Minikube's dashboard, where you can more things  \n```minikube dashboard```\n\u003c/details\u003e\n\n## Parameters \n* Directory: Defaults to `$PWD` or current directory. The directory in which to look for Terraform files. \nThis is required if the user wants to use a Terraform project as input \n(instead of uploading a file or pasting DOT script). \n* `--host`: Defaults to 0.0.0.0. The IP address to bind to, to access the app (http://HOST:5000)\n* `--port`: Defaults to 5000. The port to access the app (http://localhost:PORT) \nAny valid localhost port is allowed.\n* `--serve`: Starts a webserver locally with Terraform's interactive graph\n* `--json`: Prints a JSON representation of a Terraform graph. The JSON has 2 items, `edges` and `nodes`. \n* `--dot`: Returns a string consisting of Graphviz DOT script of graph. (no colors)\n* `--svg`: Prints SVG representation of graph (with colors).\n* `--graph`: \n* `--module-depth`: Takes an integer as input and only eliminates display of deeply nested modules. \nThis will not show every node on the graph unless the user specifies a depth larger than the graph.\n*  `--focus`: Show only specified resource and its dependencies. Not available in web app. Only works with `--json` and `--svg`.\n  * Example: ```terraform graph | blast-radius --focus \\\n    \"[root] module.us-west-2.module.secondary_subnet.data.aws_vpc.target\" --svg```\n* `--center`: Prunes the graph to a subgraph (same thing as red button in web app). Only works with `--json` and `--svg`.\n  * Example: ```terraform graph | blast-radius --center \\\n    \"[root] module.us-west-2.module.secondary_subnet.data.aws_vpc.target\" --svg``` \n\n## Embedded Figures\n\nYou may wish to embed figures produced with *Blast Radius* in other documents.\nYou will need the following:\n\n1. An `svg` file and `json` document representing the graph and its layout.\n2. `javascript` and `css` found in `.../blastradius/server/static`\n3. A uniquely identified DOM element, where the `\u003csvg\u003e` should appear.\n\nYou can read more details in the [documentation for embedded figures](doc/embedded.md).\n\n## How It Works\n\n*Blast Radius* uses \n- [Graphviz](https://graphviz.org/) package to layout graph diagrams\n- [python-hcl2](https://github.com/amplify-education/python-hcl2) to parse [Terraform][] configuration\n- [d3.js](https://d3js.org/) to implement interactive features\n- [Flask](https://flask.palletsprojects.com/) to start a server\n- [Vanilla JavaScript](http://vanilla-js.com/) and [jQuery](https://jquery.com/) for front-end functionality\n- [HTML](https://html.com/), [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS), \n- [Bootstrap](https://getbootstrap.com/), and other libraries for front-end design\n\nTerraform generates graphs in the form of [DOT](https://en.wikipedia.org/wiki/DOT_language) language. *Blast Radius* \nuses [Graphviz](https://graphviz.org/) to layout the graph after converting to SVG, \nand D3.js to implement interactive features. \nTerraform configurations are then parsed by [python-hcl2](https://github.com/amplify-education/python-hcl2) to generate \na [JSON](https://en.wikipedia.org/wiki/JSON_document) representation of the graph, \nwhich provides details of each resource on hover.\nAll of this is hosted on [Flask](https://flask.palletsprojects.com/) and runs on a [local server](http://localhost:5000/). \n\n## Motivation\nThe original creator of this open source project, [Patrick McMurchie](https://github.com/28mm), has been inactive on \nthis project for some time. \nThere are many issues waiting to be resolved, and features to be added. This repository presents some \n**basic modifications**, **additional features**, and **enhanced accessibility**.  \n\n## What's Different\n* **Independence** from Terraform and Terraform files\n  * App can run on its own, accepting DOT file or keyboard input \n* Multi-graph feature\n  * The app can **display multiple graphs** and can be compared side by side with tabs \n* Print \n  * The graph can be printed, although the print can sometimes cut off the graph at times\n* UI changes\n  * To enable a better design, the multi-colored buttons and other parts of the page have been changed to follow the 60-30-10 design rule\n* Compatability with recent versions of Terraform, Python, and Python packages\n* Created a new Docker image at [ianyliu/blast-radius-fork](https://hub.docker.com/repository/docker/ianyliu/blast-radius-fork/) for multi-cpu architectures equipped with updated features\n* Added Shell scripts that can be used to run \u0026 build the Docker image with aliases for convenience \n* Updated README.md \n* Integrated changes across other forks and pull requests of Blast Radius, including: \n  * PowerShell scripts for running and building Docker containers\n  * Running Terratests during Docker build\n  * Allowing Blast Radius to run even if JSON data couldn't be parsed  \n\n## Future Implementations \u0026 Possible Functionalities\n* Accept file input as a command-line argument \n  * (```Ex. blast-radius --serve --graphfile ./graphraw.txt```)\n* Allow downloading of other file formats such as .json, .png, .jpg, .zip with entire static assets \n* Hovering over tabs display number of resources or perhaps a snapshot of the graph\n* Allow upload of multiple files and folders\n* Drag and drop file upload \n* Dark mode \n* Support for Terragrunt \n* Support for Tfenv \n* Compress Docker image size (currently 180+MB)\n* Editable tab names\n* Reorder tabs via drag\n* Responsive webpage\n* Add filter by color option for graphs \n* Graph sharing\n  * Generate unique URL to allow users to view graphs created by others\n* Create standalone executable (run without CLI)\n  * Docker2exe\n  * PyInstaller \n* Mobile interface formatting\n* Loading spinner before graphs load (and disable buttons)\n* Cache DOT script or SVG in local storage so it can be loaded next time without re-upload\n* Animation\n  * Shows difference between current state and state after apply\n  * Shows difference between one Terraform graph and another via animation \n* Add example Terraform DOT files that allow Blast Radius to be run on Microsoft Azure, Google Cloud, IBM Cloud Services, etc.\n* Integration with Neo4j or other graph database, parse *Terraform* files and find relationships between resources\n\n\n## Further Reading\n\nThe original development of *Blast Radius* is documented in a series of\n[blog](https://28mm.github.io) posts by the original creator:\n\n* [part 1](https://28mm.github.io/notes/d3-terraform-graphs): motivations, d3 force-directed layouts vs. vanilla graphviz.\n* [part 2](https://28mm.github.io/notes/d3-terraform-graphs-2): d3-enhanced graphviz layouts, meaningful coloration, animations.\n* [part 3](https://28mm.github.io/notes/terraform-graphs-3): limiting horizontal sprawl, supporting modules.\n* [part 4](https://28mm.github.io/notes/d3-terraform-graphs-4): search, pan/zoom, prune-to-selection, docker.\n\nA catalog of example *Terraform* configurations, and their dependency graphs\ncan be found [here](https://28mm.github.io/blast-radius-docs/).\n\n* [AWS two-tier architecture](https://28mm.github.io/blast-radius-docs/examples/terraform-provider-aws/two-tier/)\n* [AWS networking (featuring modules)](https://28mm.github.io/blast-radius-docs/examples/terraform-provider-aws/networking/)\n* [Google two-tier architecture](https://28mm.github.io/blast-radius-docs/examples/terraform-provider-google/two-tier/)\n* [Azure load-balancing with 2 vms](https://28mm.github.io/blast-radius-docs/examples/terraform-provider-azurem/2-vms-loadbalancer-lbrules/)\n\nThese examples are drawn primarily from the `examples/` directory distributed\nwith various *Terraform* providers, and aren't necessarily ideal. Additional\nexamples, particularly demonstrations of best-practices, or of multi-cloud\nconfigurations strongly desired.\n\nThere are 258 forks as of October 2024, each containing new updates or features of some sort. Notable ones include: \n- https://github.com/gruberdev/blast-radius/\n- https://github.com/IBM-Cloud/blast-radius/\n- https://github.com/nishubharti/blast-radius/ \n- https://github.com/obourdon/blast-radius/\n- https://github.com/nibhart1/blast-radius/\n\nAn alternate working Docker image for Blast Radius is https://hub.docker.com/r/grubertech/blast-radius\n\n\nIt would greatly help if you could contribute to bringing all of these forks into one repository so that we can have a tool that can be used by everyone.\n\n## Other Tools to Check Out\n\n[Inframap]: https://github.com/cycloidio/inframap\n[Terraform Graph Beautifier]: https://github.com/pcasteran/terraform-graph-beautifier\n[Terraform Visual]: https://github.com/hieven/terraform-visual\n[Rover]: https://github.com/im2nguyen/rover\n[Pluralith]: https://www.pluralith.com/\n* [Pluralith]\n  * \"_A tool for Terraform state visualisation and automated generation of infrastructure documentation_\"\n  * Written in: Golang\n  * Pros\n    * Change Highlighting\n    * Apply plan within application\n    * Cost information\n    * Provides granular details on click\n    * Plan-to-plan comparison (tabs)\n    * Filter (by Created, Destroyed, Updated, Recreated)\n    * GUI (Graphical User Interface)\n    * Lots more features... there's so many!\n  * Cons\n    * More advanced features cost money (understandably)\n    * Newer, with less tutorials and tests\n* [Inframap]\n    * \"_Read your tfstate or HCL to generate a graph specific for each provider, showing only the resources that are most important/relevant._\"\n    * Input: tfstate or HCL\n    * Written in: Golang\n    * Pros: \n      * Works directly with Terraform state files or .tf files, instead of DOT input\n      * Docker\n      * Simplifies graph\n    * Cons:\n      * Cannot provide more detail, oversimplification\n* [Terraform Graph Beautifier]\n  * \"_Terraform graph beautifier_\"\n  * Input: DOT script output from ```terraform graph``` command in Terraform init directory\n  * Written in: Golang\n  * Pros\n    * Outputs to: HTML page, JSON document, cleaner version of Graphviz DOT script\n  * Cons \n    * Requires Terraform init directory and Terraform installation\n* [Terraform Visual]\n  * \"_Terraform Visual is an interactive way of visualizing your Terraform plan_\"\n  * Input: Terraform JSON plan files\n  * Written in: TypeScript, JavaScript, CSS\n  * Pros\n    * Docker compatible\n    * Creates HTML page that you can save later\n    * Has online version: https://hieven.github.io/terraform-visual/  (so doesn't require local installation)\n* [Rover]\n  * \"_Interactive Terraform visualization. State and configuration explorer._\"\n  * Inputs: Terraform files in a directory or provided plan file\n  * Written in: Golang, VueJS\n  * Pros\n    * Very granular view and control of resources \n    * Shareable via .svg, .html, .json \n    * Standalone mode generates .zip file containing all static assets \n    * Docker compatible\n  * Cons\n    * Requires Terraform directory to be init, or else it will not work (even in Docker it also needs init)\n\n\n## Star History\n\n\u003ca href=\"https://star-history.com/#ianyliu/blast-radius-fork\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=ianyliu/blast-radius-fork\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=ianyliu/blast-radius-fork\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=ianyliu/blast-radius-fork\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIanyliu%2Fblast-radius-fork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIanyliu%2Fblast-radius-fork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIanyliu%2Fblast-radius-fork/lists"}