an interactive Terraform graph

Antoine - Jun 21 '20 - - Dev Community

Photo by David Pisnoy on Unsplash

Terraform already has a graph command that can be used with dot to produce a svg graph. But this graph is not interactive.

Blast-radius is a tool producing a svg graph interactive in a web browser, based on Terraform graph. You can see online examples for many providers.

Alt Text

A warning about version

I have tried to use it before, but due to parsing issues during the upgrade from Terraform 0.11 to 012 (and the producing / integration of the new pyhcl library), i had to stop it. But now, it is working again (if you use Terraform 0.12 or higher )!

How to use it

You have to position yourself inside your project directory. See the docs to know where you should be.

The easiest way for me to use it, is through the Docker image.

Modifying the Dockerfile in this issue, you can easily set the terraform version you need. Create the dockerfile locally and build it.

Then, run the following command in your project directory (if it contains your .terraform):

docker run --rm -it -p 5000:5000 -v ${pwd}:/data --cap-add=SYS_ADMIN myDockerImageBasedOnBlastRadius --serve .

Now go to http://localhost:5000/ and you should see your graph.

Hope this helps !

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player