Hands-on: Try the Perform Dynamic Operations with Functions tutorial.
The Terraform 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:
For more details on syntax, see Function Calls in the Expressions section.
You cannot define your own functions in the Terraform configuration language, but you can develop your own providers that expose functions. Refer to Provider-defined functions for information about defining functions in custom providers.
When using a provider-specific function, add the provider::<local-name>::
where <local-name>
corresponds with an entry in the required_providers
block. The following example calls the encode_tfvars
function in the terraform
provider:
provider::terraform::encode_tfvars({
example = "Hello!"
})
The documentation covers the built-in functions and built-in provider-defined functions only.
Functions defined by external providers are documented by those providers in the Terraform Registry.
You can experiment with the behavior of Terraform's built-in functions from the Terraform expression console, by running the terraform console
command:
The examples in the documentation for each function use console output to illustrate the result of calling the function with different parameters.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4