Skip to main content

Built-in Functions

The OpenTofu language includes a number of built-in functions that you can call from within expressions to transform and combine values. The general syntax for function calls is a function name followed by comma-separated arguments in parentheses:

Code Block
max(5, 12, 9)

For more details on syntax, see Function Calls in the Expressions section.

The OpenTofu language does not support user-defined functions, and so only the functions built in to the language are available for use. The documentation includes a page for all of the available built-in functions.

You can experiment with the behavior of OpenTofu's built-in functions from the OpenTofu expression console, by running the tofu console command:

Code Block
> max(5, 12, 9)
12

The examples in the documentation for each function use console output to illustrate the result of calling the function with different parameters.