28mm / blast-radius

Interactive visualizations of Terraform dependency graphs using d3.js
https://28mm.github.io/blast-radius-docs/
MIT License
2.04k stars 257 forks source link

Basic Architecture Diagram? #59

Closed StevenR152 closed 5 years ago

StevenR152 commented 5 years ago

I've spend a few hours looking at blast radius and it looks great!

What I was aiming to achieve was automatically generating Architecture diagrams anytime our terraform script changed.

My issue is that the level of detail is very detailed, I'm wanting a diagram that shows S3 connects to lambda, which goes to dyno then a SNS queue etc.

I'm wondering if theres a way to restrict the UI being served to only show the top level of each terraform resource we are defining not the variables (as we have heaps of tags and other stuff).

Any suggestions?

syntaqx commented 5 years ago

Given that terraform graph provides configuration on a per-directory level you could accomplish what you're asking for by having separation with modules, and then defining each diagram into a functional stack. This is generally ideal for keeping state size under control anyways (and is the recommendation from Hashibois). A really quick example:

`-- project/
    |-- modules/
    |   |-- aws-s3/
    |   |-- aws-sns/
    |   `-- aws-dynamodb/
    `-- stacks/
        `-- global-dns/
             `-- .terraform
        `-- some-database/
             `-- .terraform
        `-- static-site-with-sns/
             `-- .terraform

Then, simply target that stack with blast-radius and let Terraform know you don't want modules to behave recursively (I randomly chose 3 so configure that to whatever you feel is basic enough):

TF_CLI_ARGS_graph=-module-depth=3
blast-radius --serve /stacks/static-site-with-sns

Beyond that, there's not much more that blast-radius can do given it's just an extension of Terraform, and that's the major option provided.

StevenR152 commented 5 years ago

Thanks! Seems like that'll do the job for me