Functions | Terraform
Terraform functions are built-in, reusable code blocks that perform specific tasks within Terraform configurations.
The Terraform language does not support user-defined functions, so only the functions built
into the language are available for use.
A built-in function is a function that is already available in a programming language, application, or another tool that can be accessed by end users.
Supported built-in functions
☑ abs(float)
☑ file(path),
floor(float),
formatlist(format, args, …)
☑ indent(numspaces, string),
join(delim, list)
☑ keys(map),
length(list), list(items, …),
map(key, value, …)
☑ replace(string, search, replace),
slice(list, from, to)
☑ split(delim, string),
timestamp()
☑ values(map)
Types of Functions
- Numeric
- String
- Collection
- Encoding
- File system
- Date & Time
- Hash & Crypto
Read more function-type