Command: graph

The terraform graph command produces descriptions of the relationships between objects in a Terraform configuration, using the DOT language.

Usage

Usage: terraform graph [options]

By default the result is a simplified graph which describes only the dependency ordering of the resources (resource and data blocks) in the configuration.

The -type=... option optionally selects from a number of other graph types which have more detail, at the expense of also exposing some of the implementation details of the Terraform language runtime.

Options:

Generating Images

The graph output uses the DOT language, which is a machine-readable graph description language which originated in Graphviz. You can use the Graphviz dot command to present the resulting graph description as an image. There are also various third-party online graph rendering services which accept this format.

If you have the Graphviz dot command already installed, you can render a PNG image by piping into that command:

$ terraform graph -type=plan | dot -Tpng >graph.png

The following is an example result:

A visualization of the plan graph of a hypothetical Terraform configuration, produced by dot