Support for configuring mermaid environment
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.
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
countoror_eachloop that provisions multiple resources, would you prefer to visualize it like this?
flowchart LR
A[aws_subnet] --> B[aws_ec2_instance\nCount: 25]
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 - 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!
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)"}
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_bucketallow/block this entire resource type. alternatively something likeaws_s3_bucket.*may be easier to impl -
aws_s3_bucket.fooallow/block just 1 instance of the resource type