Getting started with Terraform functions ??? V1.0

When I first started with Terraform to write configuration to deploy infrastructure on AWS and GCP, I did not know how powerful Terraform is.
I wrote configuration code like an armature — repeated code blocks, hardcoded values, bloated and inflexible infrastructure configuration code.

It took me a while to start using Terraform’s built-in functions, and everything changed. I learned to leverage Terraform functions in my configuration code. My terraform code got 10x more flexible, manageable, readable, scalable, and DRY.

Let's get started with Terraform functions

The Terraform language includes several built-in functions that you can call from within expressions to transform and combine values.

Note: The Terraform language does not support user-defined functions, and so only the functions built into the language are available for use.

The most commonly used Terraform function

List functions

  • formatlist(): formatlist produces a list of strings by formatting a number of other values according to a specification string.

It’s particularly useful when you want to create a formatted string by combining elements from a list, and you want to apply a consistent formatting pattern to those elements.

Visit Now