github.com/hugorut/terraform@v1.1.3/website/docs/cli/commands/graph.mdx (about)

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