github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/website/docs/cli/commands/console.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Command: console"
     4  sidebar_current: "docs-commands-console"
     5  description: "The terraform console command provides an interactive console for
     6    evaluating expressions."
     7  ---
     8  
     9  # Command: console
    10  
    11  The `terraform console` command provides an interactive console for
    12  evaluating [expressions](/docs/language/expressions/index.html).
    13  
    14  ## Usage
    15  
    16  Usage: `terraform console [options]`
    17  
    18  This command provides an interactive command-line console for evaluating and
    19  experimenting with [expressions](/docs/language/expressions/index.html).
    20  This is useful for testing interpolations before using them in configurations,
    21  and for interacting with any values currently saved in
    22  [state](/docs/language/state/index.html).
    23  
    24  If the current state is empty or has not yet been created, the console can be
    25  used to experiment with the expression syntax and
    26  [built-in functions](/docs/language/functions/index.html).
    27  
    28  You can close the console with the `exit` command or by pressing Control-C
    29  or Control-D.
    30  
    31  For configurations using
    32  [the `local` backend](/docs/language/settings/backends/local.html) only,
    33  `terraform console` accepts the legacy command line option
    34  [`-state`](/docs/language/settings/backends/local.html#command-line-arguments).
    35  
    36  ## Scripting
    37  
    38  The `terraform console` command can be used in non-interactive scripts
    39  by piping newline-separated commands to it. Only the output from the
    40  final command is printed unless an error occurs earlier.
    41  
    42  For example:
    43  
    44  ```shell
    45  $ echo "1 + 5" | terraform console
    46  6
    47  ```
    48  
    49  ## Remote State
    50  
    51  If [remote state](/docs/language/state/remote.html) is used by the current backend,
    52  Terraform will read the state for the current workspace from the backend
    53  before evaluating any expressions.