terraform/website/source/docs/commands/graph.html.markdown

47 lines
1.4 KiB
Markdown
Raw Normal View History

2014-07-25 00:44:10 +02:00
---
layout: "docs"
page_title: "Command: graph"
sidebar_current: "docs-commands-graph"
2014-10-22 05:21:56 +02:00
description: |-
The `terraform graph` command is used to generate a visual representation of either a configuration or execution plan. The output is in the DOT format, which can be used by GraphViz to generate charts.
2014-07-25 00:44:10 +02:00
---
# Command: graph
The `terraform graph` command is used to generate a visual
representation of either a configuration or execution plan.
The output is in the DOT format, which can be used by
2014-07-25 21:41:27 +02:00
[GraphViz](http://www.graphviz.org) to generate charts.
2014-07-25 00:44:10 +02:00
## Usage
Usage: `terraform graph [options] PATH`
2014-07-25 00:44:10 +02:00
Outputs the visual graph of Terraform resources. If the path given is
the path to a configuration, the dependency graph of the resources are
shown. If the path is a plan file, then the dependency graph of the
plan itself is shown.
Options:
* `-module-depth=n` - The maximum depth to expand modules. By default this is
zero, which will not expand modules at all.
2014-07-25 00:44:10 +02:00
## Generating Images
The output of `terraform graph` is in the DOT format, which can
easily be converted to an image by making use of `dot` provided
by GraphViz:
```
$ terraform graph | dot -Tpng > graph.png
```
Alternatively, the web-based [GraphViz Workspace](http://graphviz-dev.appspot.com)
2014-07-25 00:44:10 +02:00
can be used to quickly render DOT file inputs as well.
Here is an example graph output:
2014-11-18 02:54:29 +01:00
![Graph Example](graph-example.png)
2014-07-25 00:44:10 +02:00