cycloidio / inframap

Read your tfstate or HCL to generate a graph specific for each provider, showing only the resources that are most important/relevant.
MIT License
1.74k stars 94 forks source link

Graphing Terraform modules #51

Open skyzyx opened 4 years ago

skyzyx commented 4 years ago

My team vends many Terraform modules out to the larger organization. Because they're modules, they don't have state. I would love to be able to generate a graph of the resources created by these modules, and how they are interconnected.

I write *.tf files that pair with my Terratest *.go code, so I could probably invoke the module to get the state of the test file and generate from that, but it would be nice to be able to pass my raw *.tf files (perhaps with some annotations in comments? I'm still learning the Hashicorp HCL Golang package to understand what's possible) and be able to generate a nice graph for the README and my end-users that is dramatically more user-friendly than terraform graph.

I've tested this tool on a few of my modules, and some have some data, and some come up blank.

Thanks!

skyzyx commented 4 years ago

Supporting modules could pair really well with #5.

xescugc commented 4 years ago

So, few questions hehe.

I've tested this tool on a few of my modules, and some have some data, and some come up blank.

This is more or less explained on the docs https://github.com/cycloidio/inframap#why-is-my-graph-generated-empty. I'll potentially reword it as I see it's a common "issue" (we have another issue opened because of that https://github.com/cycloidio/inframap/issues/53).

My team vends many Terraform modules out to the larger organization. Because they're modules, they don't have state. I would love to be able to generate a graph of the resources created by these modules, and how they are interconnected.

InfraMap works also with HCL, it's not needed the TFState if you want :smile: inframap generate --hcl ./my-module/ which looks like what you want to do, it's explained on the README but perhaps not good enough if you only thought it was only possible from TFState. If that's the case what whould you improve on the README?

Supporting modules could pair really well with #5.

I did not thought about it, but I see more like https://github.com/cycloidio/inframap/issues/6, in which we group resources that are from the same Module the #5 would not be visually helpful as it would not indicate that "Those 5 elements are from the same Module", at least this is what I think :)

CalvinRodo commented 2 years ago

If it requires a flag then the documentation has a bug in it:

https://github.com/cycloidio/inframap/blob/79fba01d3452b29eb4985444d0657f36b6425cf6/README.md?plain=1#L102 https://github.com/cycloidio/inframap/blob/79fba01d3452b29eb4985444d0657f36b6425cf6/README.md?plain=1#L130 https://github.com/cycloidio/inframap/blob/79fba01d3452b29eb4985444d0657f36b6425cf6/README.md?plain=1#L136 https://github.com/cycloidio/inframap/blob/79fba01d3452b29eb4985444d0657f36b6425cf6/README.md?plain=1#L142

skyzyx commented 2 years ago

Sorry for the delay — I seem to have missed the original response from last August. Let me try this.

xescugc commented 2 years ago

If it requires a flag then the documentation has a bug in it:

It does not require a flag (but you can use it) but the comment was done before I implemented the automated detection of HCL/State so that's why it has a flag on it hehe. It was implemented on 2021-03-12.