
Launching the OpenTofu Console
To experiment with functions and interpolations in a live environment, start the interactive console:The OpenTofu console evaluates HCL expressions in real time. You can inspect variables, resources, and file contents without applying changes.
Exploring Functions in the Console
Given this configuration snippet:file(path)reads the file’s content.length(list)returns the number of elements (here,3).toset(list)converts a list to a set, removing duplicates.
Numeric Functions
Numeric functions allow you to compare values and perform rounding:Use the expansion operator
... to unpack a collection into individual arguments.String Functions
Manipulate and transform text with string functions:Collection Functions
List Operations
Map Operations
Calling
lookup without a default value will error if the key does not exist.