github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/website/source/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  Options:
    29  
    30  * `-draw-cycles`    - Highlight any cycles in the graph with colored edges.
    31                        This helps when diagnosing cycle errors.
    32  
    33  * `-module-depth=n` - The maximum depth to expand modules. By default this is
    34                        zero, which will not expand modules at all.
    35  
    36  * `-verbose`        - Generate a verbose, "worst-case" graph, with all nodes
    37                        for potential operations in place.
    38  
    39  ## Generating Images
    40  
    41  The output of `terraform graph` is in the DOT format, which can
    42  easily be converted to an image by making use of `dot` provided
    43  by GraphViz:
    44  
    45  ```
    46  $ terraform graph | dot -Tpng > graph.png
    47  ```
    48  
    49  Alternatively, the web-based [GraphViz Workspace](http://graphviz-dev.appspot.com)
    50  can be used to quickly render DOT file inputs as well.
    51  
    52  Here is an example graph output:
    53  ![Graph Example](graph-example.png)
    54