Variable Interpolation:
${var.variable_name}
: Interpolates the value of a variable.
Resource Attribute Interpolation:
${resource_type.resource_name.attribute}
: Interpolates the value of a specific attribute of a resource.
Data Attribute Interpolation:
Output Interpolation:
${output.output_name}
: Interpolates the value of an output variable.
String Interpolation:
"${expression}"
: Interpolates a string with an expression.
List Interpolation:
[element1, element2, ...]
: Interpolates a list of elements.
Map Interpolation:
{key1 = value1, key2 = value2, ...}
: Interpolates a map of key-value pairs.
Conditional Interpolation:
condition ? true_val : false_val
: Interpolates a value based on a condition.
Numeric Interpolation:
- Arithmetic operations:
+
,-
,*
,/
,%
: Interpolates the result of arithmetic operations on numbers.
- Arithmetic operations:
Splat Expression Interpolation:
${resource_type.resource_name.*.attribute}
: Interpolates a list of values for a specific attribute of multiple resources.
Count Interpolation:
${count.index}
: Interpolates the current index value when using resource or module count.
Element Interpolation:
${list[index]}
: Interpolates a specific element from a list based on the index.
Lookup Interpolation:
${lookup(map, key, default)}
: Interpolates the value of a key in a map and provides a default value if the key doesn't exist.
File Interpolation:
${file(path)}
: Interpolates the content of a file at the specified path.
Templatefile Interpolation:
${templatefile(path, vars)}
: Interpolates the content of a template file at the specified path, replacing variables with values from thevars
map.
Join Interpolation:
${join(delimiter, list)}
: Interpolates a string by joining elements of a list with the specified delimiter.
Lower and Upper Case Interpolation:
${lower(string)}
: Interpolates a lowercase version of the given string.${upper(string)}
: Interpolates an uppercase version of the given string.
Regex Replace Interpolation:
${replace(string, regex, replacement)}
: Interpolates a string by replacing substrings matching a regex pattern with a specified replacement.
JSON Interpolation:
${jsonencode(data_structure)}
: Interpolates a JSON-encoded string representation of a data structure.
Terraform Function Interpolation:
${function_name(arg1, arg2, ...)}
: Interpolates the result of a Terraform function call with the specified arguments.