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

Possibly to display only partially graph? #27

Closed AnthonyWC closed 6 years ago

AnthonyWC commented 6 years ago

This is a question; with terraform it is possible to display specific resource/module by using the target feature with plan, e.g:

terraform plan -target=resource.foo -o=plan.tfplan
terraform graph -verbose plan.tfplan | dot -Tpng > graph.png

Is that also possible to display only that specific graph with blast-radius?

Currently if I use apply the same specific graph with:

terraform graph -verbose plan.tfplan | blast-radius --svg > graph.svg

It would still display the entire graph (unlike in graph.png) (perhaps due to the parsing of the HCL which isn't targeted)

28mm commented 6 years ago

@AnthonyWC 3 options:

  1. In --serve mode, use the red "prune to subgraph" button screen shot 2018-03-01 at 1 47 38 pm
  2. use the --center argument, to do the same thing from the command line. e.g.
    [...]$ terraform graph           \
         | blast-radius --center \
         "[root] module.us-west-2.module.secondary_subnet.data.aws_vpc.target" \
         --svg
  3. use the --focus argument to show only the specified resource and its dependencies.
    [...]$ terraform graph          \
         | blast-radius --focus \
         "[root] module.us-west-2.module.secondary_subnet.data.aws_vpc.target" \
         --svg
elttam-ben commented 5 years ago

Really great feature, should be added to the README.md. It was not immediately apparent to me that it only works with --svg (and it also works with --json).

I'd like to be able to do focus and not just center in the GUI.