Command: console
Theterraform console command provides an interactive console for evaluating expressions.
Usage
Options
-
-state=path- Path to a Terraform state file to use to look up Terraform-managed resources. By default, Terraform will consult the state of the currently-selected workspace as usual. Legacy option for the local backend only. See the local backend documentation for more information. -
-plan- Create a new plan (as if runningterraform plan) and then evaluate expressions against its planned state instead of evaluating against the current state. You can use this to inspect the effects of configuration changes that haven’t been applied yet. -
-var 'NAME=VALUE'- Sets a value for a single input variable declared in the root module of the configuration. Use this option multiple times to set more than one variable. Refer to Input Variables on the Command Line for more information. -
-var-file=FILENAME- Sets values for potentially many input variables declared in the root module of the configuration, using definitions from a “tfvars” file. Use this option multiple times to include values from more than one file.
-var and -var-file options. Refer to Assigning Values to Root Module Variables for more information.
Scripting
Theterraform console command can be used in non-interactive scripts by piping newline-separated commands to it. Only the output from the final command is printed unless an error occurs earlier.
For example:
Console-Only Functions
Theterraform console command provides access to additional functions that are only available in the console, not in normal Terraform configurations. These functions are intended for debugging and experimentation.