github.com/pdecat/terraform@v0.11.9-beta1/website/docs/commands/graph.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Command: graph"
     4  sidebar_current: "docs-commands-graph"
     5  description: |-
     6    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.
     7  ---
     8  
     9  # Command: graph
    10  
    11  The `terraform graph` command is used to generate a visual
    12  representation of either a configuration or execution plan.
    13  The output is in the DOT format, which can be used by
    14  [GraphViz](http://www.graphviz.org) to generate charts.
    15  
    16  
    17  ## Usage
    18  
    19  Usage: `terraform graph [options] [DIR]`
    20  
    21  Outputs the visual dependency graph of Terraform resources according to
    22  configuration files in DIR (or the current directory if omitted).
    23  
    24  The graph is outputted in DOT format. The typical program that can
    25  read this format is GraphViz, but many web services are also available
    26  to read this format.
    27  
    28  The -type flag can be used to control the type of graph shown. Terraform
    29  creates different graphs for different operations. See the options below
    30  for the list of types supported. The default type is "plan" if a
    31  configuration is given, and "apply" if a plan file is passed as an
    32  argument.
    33  
    34  Options:
    35  
    36  * `-draw-cycles`    - Highlight any cycles in the graph with colored edges.
    37                        This helps when diagnosing cycle errors.
    38  
    39  * `-no-color`       - If specified, output won't contain any color.
    40  
    41  * `-type=plan`      - Type of graph to output. Can be: plan, plan-destroy, apply, legacy.
    42  
    43  ## Generating Images
    44  
    45  The output of `terraform graph` is in the DOT format, which can
    46  easily be converted to an image by making use of `dot` provided
    47  by GraphViz:
    48  
    49  ```shell
    50  $ terraform graph | dot -Tsvg > graph.svg
    51  ```
    52  
    53  Here is an example graph output:
    54  ![Graph Example](docs/graph-example.png)