pcasteran / terraform-graph-beautifier Goto Github PK
View Code? Open in Web Editor NEWTerraform graph beautifier
License: Apache License 2.0
Terraform graph beautifier
License: Apache License 2.0
Hi, I downloaded prebuilt binaries for darwin from GitHub Releases but they don't work on my laptops.
Prebuilt binaries
My laptops
I tried both prebuilt binaries for darwin/amd64 and darwin/arm64.
darwin/arm64
$ ./terraform-graph-beautifier_0.3.3_darwin_arm64.tar.gz/terraform-graph-beautifier --help
zsh: killed --help
darwin/amd64
$ ./terraform-graph-beautifier_0.3.3_darwin_amd64.tar.gz/terraform-graph-beautifier --help
zsh: segmentation fault --help
darwin/amd64
./terraform-graph-beautifier_0.3.3_darwin_amd64.tar.gz/terraform-graph-beautifier --help
zsh: segmentation fault --help
On the other hand, the prebuilt binary for linux/arm64 works well on linux/arm64 (lima).
$ ./terraform-graph-beautifier_0.3.3_linux_arm64.tar.gz/terraform-graph-beautifier --help
Usage of /home/shunsukesuzuki.linux/.local/share/aquaproj-aqua/pkgs/github_release/github.com/pcasteran/terraform-graph-beautifier/v0.3.3/terraform-graph-beautifier_0.3.3_linux_arm64.tar.gz/terraform-graph-beautifier:
-cyto-html-template string
Path of the HTML template to use for Cytoscape.js rendering (output-type="cyto-html"), if not set a default one is used
-debug
Print debugging information to stderr
-embed-modules
Embed a module subgraph inside its parent if true; otherwise the two modules are drawn at the same level and an edge is drawn from the parent to the child (default true)
-exclude value
Pattern (regexp) of the resource to filter out (can be repeated multiple times)
-graph-name string
Name of the output graph, defaults to working directory name (default "aqua-registry")
-input string
Path of the input Graphviz file to read, if not set 'stdin' is used
-keep-tf-junk
Do not remove the "junk" nodes and edges generated by 'terraform graph' (default false)
-output string
Path of the output file to write, if not set 'stdout' is used
-output-type string
Type of output, can be one the following : cyto-json, cyto-html, graphviz (default "cyto-html")
-v Print command version and exit
So this is the issue of prebuilt binaries for darwin.
I tried to build terraform-graph-beautifier from source code by go install
, then it works well.
$ go install github.com/pcasteran/terraform-graph-beautifier@latest
go: downloading github.com/pcasteran/terraform-graph-beautifier v0.3.3
go: downloading github.com/awalterschulze/gographviz v2.0.3+incompatible
$ ~/go/bin/terraform-graph-beautifier --help
Usage of /Users/shunsukesuzuki/go/bin/terraform-graph-beautifier:
-cyto-html-template string
Path of the HTML template to use for Cytoscape.js rendering (output-type="cyto-html"), if not set a default one is used
-debug
Print debugging information to stderr
-embed-modules
Embed a module subgraph inside its parent if true; otherwise the two modules are drawn at the same level and an edge is drawn from the parent to the child (default true)
-exclude value
Pattern (regexp) of the resource to filter out (can be repeated multiple times)
-graph-name string
Name of the output graph, defaults to working directory name (default "aqua-registry")
-input string
Path of the input Graphviz file to read, if not set 'stdin' is used
-keep-tf-junk
Do not remove the "junk" nodes and edges generated by 'terraform graph' (default false)
-output string
Path of the output file to write, if not set 'stdout' is used
-output-type string
Type of output, can be one the following : cyto-json, cyto-html, graphviz (default "cyto-html")
-v Print command version and exit
If the graph beautifier had the ability to export directly to svg/png format files,
these could be embedded into our terrform repos readme.md
Hi and thanks for a great tool!
It's great for understanding existing Terraform code. I'm aware of the -exclude
option but it doesn't quite cut it. What would be great to have is an option to specify a resource name, and based on that, the tool would filter out everything else that doesn't either depend on it or is depended on the given resource thereby presenting just a "slice" of the graph. This is to aid working with big graphs, especially that it doesn't seem to be possible to CTRL-F on the generated .html file (I guess that's due to how Cytoscape.js works).
This would require implementing some simple graph traversals but would reduce the graph to "just the interesting parts" when debugging some Terraform issue.
Curious to hear your thoughts
Using terraform-graph-beautifier with Terraform 0.13:
module.module_name (expand)
and module.module_name (close)
)(expand)
label on every node.Using 0.12:
terraform graph | terraform-graph-beautifier --exclude="module.root.provider" --output-type=cyto-html > tf-0.12.html
Using 0.13:
terraform graph | terraform-graph-beautifier --exclude="module.root.provider" --output-type=cyto-html > tf-0.13.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.