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

Adapted docker to tf module/stack setup #16

Closed daniel-ciaglia closed 6 years ago

daniel-ciaglia commented 6 years ago
28mm commented 6 years ago

@daniel-ciaglia thanks for the pull request. I’m away from the keyboard, but should have a chance to try these changes on Monday. -- sorry I am somewhat delayed getting to this, I'm looking forward to checking it out.

28mm commented 6 years ago

Works like a charm, @daniel-ciaglia, thank you 👍

One point of curiosity, since I am not a heavy user of Docker: as you point out, Terraform uses absolute paths for symlinks in.terraform/modules/, and Docker volume mapping breaks this.

I've also had the problem--as a user of Docker for Mac--that .terraform/ directories initialized under MacOS are incompatible with the Terraform version under linux. So I've been in the habit of blowing away my .terraform/ directories, before running the docker image...

I'd like to be able to suggest a non-destructive option, in the readme. Here's a first thought...

[...]$ mkdir emptydir
[...]$ docker run -it --rm -p 5000:5000 -v $(pwd):/workdir -v $(pwd)/emptydir:/workdir/networking/.terraform  28mm/blast-radius --serve networking

But that adds some extra steps, and becomes a bit long-winded. Another option might be to over-mount the .terraform/ directory as a first step in docker-entrypoint.sh. I think mount --bind would accomplish this, otherwise some crazy hack with a loopback filesystem would too...

Anyway, I'm curious to know what you think. Thanks again :)

daniel-ciaglia commented 6 years ago

@28mm, check this PR which (at least for me) worked fine. https://github.com/28mm/blast-radius/pull/19 I'll add a comment over there.