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

Support for configuring mermaid environment #41

Open
jsidney opened this issue Aug 15, 2024 · 3 comments
Open

Support for configuring mermaid environment #41

jsidney opened this issue Aug 15, 2024 · 3 comments
Assignees
Labels
feature New functionality

Comments

@jsidney
Copy link

jsidney commented Aug 15, 2024

Is your feature request related to a problem? Please describe.
When using Terramaid to generate diagrams for more complex/large environments, the diagram does not get generated correctly since it conflicts with certain mermaid defaults. I was generating a diagram for a complex EKS environment and the diagram contained "too many edges" to be rendered correctly.

Describe the solution you'd like
It would be really nice if we could inject mermaid variables/config so to the tool so that the end-user has more control over diagrams that are generated for more complex and large environments.

Describe alternatives you've considered
I am not entirely sure if there are any alternative solutions? Considering that this tool acts as a wrapper for mermaid, the end-user doesnt get access to the mermaid environment and config.

Additional context
Add any other context or screenshots about the feature request here.

@RoseSecurity
Copy link
Owner

I'm actively working on improving this with each release, so I appreciate your feedback! The tooling handles smaller, simpler plans well, but as configurations grow, things can get messy quickly. I'd love to hear your thoughts on what aspects of the Mermaid syntax you'd like to configure.

  • Would you like to choose the diagram or chart type?
  • Also, if you have a count or or_each loop that provisions multiple resources, would you prefer to visualize it like this?
flowchart LR
A[aws_subnet] --> B[aws_ec2_instance\nCount: 25]
Loading

Thanks again for bringing this up! If you have any example configurations, please share them so we can tailor these solutions to more complex infrastructure.

@RoseSecurity RoseSecurity added the feature New functionality label Aug 21, 2024
@RoseSecurity RoseSecurity self-assigned this Aug 21, 2024
@jsidney
Copy link
Author

jsidney commented Aug 23, 2024

@RoseSecurity - can you please explain what you mean by your first point? (i dont understand the difference between chart and diagram in this case).
In terms of the dynamic resource blocks (counts and for_eachs), the example you show would be fantastic!

@cazlo
Copy link

cazlo commented Feb 15, 2025

The new Architecture Diagram type would be cool. I like the icon capabilities with that graph type, and would love to script out assignment of the related icon for a resource.

C4 diagrams would be an interesting option, especially the Component and Deployment diagram types.

There is nice but breaking changes since Mermaid v11.3.0. There are a lot more shapes available in the flowcharts which could be nice to use as an optional switch. For example for the for_each situation described previously in the thread, it would be nice to render it as a procs shape, like:

flowchart TD
    Example@{ shape: procs, label: "aws_ec2_instance (x25)"}
Loading

Something else I have found helpful with complicated diagrams is to color code based on resource type. For example all the IAM roles are orange, all the EC2s are green, etc.

There are some EKS examples available such as https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/examples/eks-managed-node-group which may prove helpful as test cases.

Edit: also an allow list and block list parameter would probably help to manually trim down large diagrams for specific views. I would probably make it accept values like

  • aws_s3_bucket allow/block this entire resource type. alternatively something like aws_s3_bucket.* may be easier to impl
  • aws_s3_bucket.foo allow/block just 1 instance of the resource type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality
Projects
Status: No status
Development

No branches or pull requests

3 participants