Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphing Terraform modules #51

Open
skyzyx opened this issue Aug 23, 2020 · 5 comments
Open

Graphing Terraform modules #51

skyzyx opened this issue Aug 23, 2020 · 5 comments

Comments

@skyzyx
Copy link

skyzyx commented Aug 23, 2020

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
Copy link
Author

skyzyx commented Aug 23, 2020

Supporting modules could pair really well with #5.

@xescugc
Copy link
Member

xescugc commented Aug 24, 2020

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 #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 😄 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 #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
Copy link

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

$ inframap generate ./my-module/ | graph-easy

With `inframap generate ./terraform/module-magento/ | dot -Tpng > inframap.png`:

With `inframap generate --connections=false ./terraform/module-magento/ | dot -Tpng > inframapconnections.png`:

With `inframap generate ./terraform/module-magento/ --raw | dot -Tpng > inframapraw.png`:

@skyzyx
Copy link
Author

skyzyx commented Apr 7, 2022

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

@xescugc
Copy link
Member

xescugc commented Apr 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants