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

Run without internet connection #34

Open joerg opened 6 years ago

joerg commented 6 years ago

Hi,

I have to work in an airgapped environment (without internet connection) where it is not possible to simply run "terraform init" or anything like this. We developed some helper framework to run terraform through a WebProxy but any call to terraform involves a lot of environment variables and a special setup of credential files for AWS and such. When I try using blast-radius I always get errors like "Failed to load backend" due to invalid credentials and the missing internet connection. Is it somehow possible to run blast-radius off a pre created graph file? Something that does not involve any "terraform" call inside the docker container? I already tried --graph like

docker run --cap-add=SYS_ADMIN -it --rm -p 5000:5000 -v $(pwd):/workdir:ro docker.registry.local/joerg/blast-radius --serve --graph global/my.graph global

but this gives the before mentioned errors. Interestingly it works with --json, --dot and --svg which gives me a huge JSON output

docker run --cap-add=SYS_ADMIN -it --rm -p 5000:5000 -v $(pwd):/workdir:ro docker.registry.local/joerg/blast-radius --json --graph global/my.graph global
28mm commented 6 years ago

Hi @joerg

One quick work-around, if you don't need docker, would be to intercept the call to terraform -- at present blast-radius only calls terraform graph, so something like this should work...

[...]$ cat > terraform <<EOF
#!/bin/bash
cat graph.json
EOF
[...]$ chmod +x terraform
[...]$ PATH="${PWD}:$PATH"
[...]$ export PATH
[...]$ blast-radius --serve

But a more fully baked solution would be nice, too. I expect to have time for a closer look in the next couple of days. Cheers :)