nerdexam
HashiCorp

TA-002-P · Question #414

Which command lets you experiment with Terraform's built-in functions?

The correct answer is B. terraform console. The terraform console command opens an interactive REPL where you can evaluate built-in functions and expressions against the current state without modifying infrastructure.

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

Which command lets you experiment with Terraform's built-in functions?

Options

  • Aterraform env
  • Bterraform console
  • Cterraform test
  • Dterraform validate

How the community answered

(22 responses)
  • B
    95% (21)
  • C
    5% (1)

Why each option

The terraform console command opens an interactive REPL where you can evaluate built-in functions and expressions against the current state without modifying infrastructure.

Aterraform env

terraform env is a legacy alias for terraform workspace and has nothing to do with evaluating functions.

Bterraform consoleCorrect

terraform console starts an interactive command-line session that evaluates Terraform expressions and built-in functions in real time. It loads the current state and allows experimentation with functions like cidrsubnet(), toset(), or jsondecode() before committing them to configuration files.

Cterraform test

terraform test runs automated tests defined in .tftest.hcl files; it is not an interactive exploration tool.

Dterraform validate

terraform validate checks configuration syntax and internal consistency but does not evaluate expressions or functions interactively.

Concept tested: Using terraform console to test built-in functions

Source: https://developer.hashicorp.com/terraform/cli/commands/console

Topics

#terraform console#terraform cli#built-in functions#hcl functions

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice