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

55 lines
1.8 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] [DIR]`
2014-07-25 00:44:10 +02:00
Outputs the visual dependency graph of Terraform resources according to
configuration files in DIR (or the current directory if omitted).
The graph is outputted in DOT format. The typical program that can
read this format is GraphViz, but many web services are also available
to read this format.
2016-12-04 00:29:04 +01:00
The -type flag can be used to control the type of graph shown. Terraform
creates different graphs for different operations. See the options below
for the list of types supported. The default type is "plan" if a
configuration is given, and "apply" if a plan file is passed as an
argument.
Options:
* `-draw-cycles` - Highlight any cycles in the graph with colored edges.
This helps when diagnosing cycle errors.
2016-12-04 00:29:04 +01:00
* `-no-color` - If specified, output won't contain any color.
2014-07-25 00:44:10 +02:00
2016-12-04 00:29:04 +01:00
* `-type=plan` - Type of graph to output. Can be: plan, plan-destroy, apply, legacy.
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:
```shell
$ terraform graph | dot -Tsvg > graph.svg
2014-07-25 00:44:10 +02:00
```
Here is an example graph output:
2017-04-06 19:44:11 +02:00
![Graph Example](docs/graph-example.png)