diagrams
diagrams copied to clipboard
Feature request: Terraform support
The diagrams that are generated are amazingly good looking. Excellent job! If a terraform script could be used as input to automatically generate them then any cloud consultant and audit department would use it in their DevOps pipeline because just like JavaDocs for Java, it would be the no brainier to generate cloud documentation. Would that be possible?
What a great idea!
It might be possible with Resource Graph
concept. Fortunately, terraform support terraform graph
command (which generates Graphviz code), so we could read the terraform script like this way:
$ terraform graph | diagrams --terraform -o graph.png
So I need to create
diagrams
command line to support it.
Read the Graphviz code generated from terraform graph
is much easier than read the HCL scripts directly.
That's a great idea. Using terraform graph
is a good starting point, but I think some kind of mapping code would be required to denote relations that go beyond what can be represented with Terraform alone.
E.g. A few instances/instance groups are in a VPC, to denote that they communicate to each, you would need to explicitly tell diagram to draw a line between them. I don't think it can safely be inferred from Terraform. E.g: the only indication may be from a certain firewall rule like allow all instances in the VPC to communicate with port 443.
To reiterate, this is a great idea and we would definitely use that.
Thank you for giving an example.
I'll have to test some complicated Terraform codes to see if this is possible.
Upvote for that request. I agree that it will be hard, if not impossible to get all relations (eg. between instances), from terraform natively. Maybe adding additional "meta" information, like tags or so, might help. Aside from the graph functionality, the statefile might be a source for gathering information.
It might be useful to take a look at a tool I help developing - https://github.com/Cloud-Architects/cloud-discovery.
We use this library as a visualization engine, provide different commands to report different parts of the infrastructure and have on-top aggregations to simplify usually complex solutions.
Hi all!
At Cycloid we have just have released a tool that does exactly what's been asked here, generate a Graph from HCL/State in a more human readable way than terraform graph
, the tool is InfraMap https://github.com/cycloidio/inframap.
The format in which the graphs are printed can be customized, for now we only support DOT, but would be possible to change it and add a diagrams
printer format.
Thanks you all!.
The idea to provide meta information to the graphs from terraform code would be very useful too.
I think the reverse! If I create a Graph could I create automatically a terraform code to deploy my environment?
There might be some useful prior-art over in in https://github.com/28mm/blast-radius
Another option is to parse tfstate which is a "simple" json instead of HCL which is much more complex.
HCL2 -> JSON: https://pypi.org/project/python-hcl2/
What a great idea!
It might be possible with
Resource Graph
concept. Fortunately, terraform supportterraform graph
command (which generates Graphviz code), so we could read the terraform script like this way:$ terraform graph | diagrams --terraform -o graph.png
So I need to create
diagrams
command line to support it.Read the Graphviz code generated from
terraform graph
is much easier than read the HCL scripts directly.
Hello mingrammer ,I hope you are doing well. I just wanted to ask, did you have any progress for the requested feature?? It is a precious tool but it needs lots of manual coding. In case of major changes in your infra it takes weeks to find details about communications and coding them.
Two requests that are complementary, yet necessarily in order below:
-
Reverse engineering of diagrams from tf plan code.
- With diagrams, docs and /etc/hosts and ansible inventory could be generated?
-
Forward engineering of diagrams to tf plan code.
- Sounds great, but this DEPENDS upon graphical and lexical standards.
Are either of these on the roadmap in any organized way?
Any update on this? or any work around for now on how we can automatically or dynamically generate diagrams for our terraform code? 🙏🏻. @mingrammer
The diagrams that are generated are amazingly good looking. Excellent job! If a terraform script could be used as input to automatically generate them then any cloud consultant and audit department would use it in their DevOps pipeline because just like JavaDocs for Java, it would be the no brainier to generate cloud documentation. Would that be possible?
Hi guys,
Mingrammer is really a cool tool but of course there are just things that requires extra work to make it functional. So is generating Terraform diagrams from code. We really spent lots of time and work to make it available. With Holori you can now generate terraform diagrams in GitHub Pull request. We support AWS, Azure and GCP and offer 50/run per month for free! Give it a spin : https://app.holori.com/
I think this has been stale for a while now. And abused for advertisements even. Any progress on the actual issue? Anyone?