Skip to content

SwissArmyRonin/terraform-graph

Repository files navigation

terraform-graph

Graph module dependencies to GML files.

Installation

Install hcl2json.

Next, run:

npm i
npm run build
npm link

Now terraform-graph should be available in your PATH.

Usage

Simple usage:

terraform-graph example/terraform-aws-eks > example/sample.gml

To use the example, make sure to checkout the sub-module first with git submodule update --init

Use something yEd to open and organize the resulting graph.

Example:

  • Open the GML file
  • Click "Tools->Fit Node to Label" (uncheck all the check boxes)
  • Click "Layout->One-Click Layout"
  • Enjoy!

terraform-graph supports a number of switches to improve results. Try running the example above with:

cd example/terraform-aws-eks
terraform init
terraform-graph -mjp > example/sample.gml

This will try to filter out irrelevant information, and will include data from external modules (requires terraform init).