github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/website/docs/cli/commands/graph.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Command: graph" 4 sidebar_current: "docs-commands-graph" 5 description: "The terraform graph command generates a visual representation of a configuration or execution plan that you can use to generate charts." 6 --- 7 8 # Command: graph 9 10 The `terraform graph` command is used to generate a visual 11 representation of either a configuration or execution plan. 12 The output is in the DOT format, which can be used by 13 [GraphViz](http://www.graphviz.org) to generate charts. 14 15 16 ## Usage 17 18 Usage: `terraform graph [options]` 19 20 Outputs the visual execution graph of Terraform resources according to 21 either the current configuration or an execution plan. 22 23 The graph is outputted in DOT format. The typical program that can 24 read this format is GraphViz, but many web services are also available 25 to read this format. 26 27 The `-type` flag can be used to control the type of graph shown. Terraform 28 creates different graphs for different operations. See the options below 29 for the list of types supported. The default type is "plan" if a 30 configuration is given, and "apply" if a plan file is passed as an 31 argument. 32 33 Options: 34 35 * `-plan=tfplan` - Render graph using the specified plan file instead of the 36 configuration in the current directory. 37 38 * `-draw-cycles` - Highlight any cycles in the graph with colored edges. 39 This helps when diagnosing cycle errors. 40 41 * `-type=plan` - Type of graph to output. Can be: `plan`, `plan-destroy`, `apply`, 42 `validate`, `input`, `refresh`. 43 44 * `-module-depth=n` - (deprecated) In prior versions of Terraform, specified the 45 depth of modules to show in the output. 46 47 ## Generating Images 48 49 The output of `terraform graph` is in the DOT format, which can 50 easily be converted to an image by making use of `dot` provided 51 by GraphViz: 52 53 ```shellsession 54 $ terraform graph | dot -Tsvg > graph.svg 55 ``` 56 57 Here is an example graph output: 58 