github.com/hugorut/terraform@v1.1.3/website/docs/language/expressions/index.mdx (about) 1 --- 2 page_title: Expressions - Configuration Language 3 description: >- 4 An overview of expressions to reference or compute values in Terraform 5 configurations, including types, operators, and functions. 6 --- 7 8 # Expressions 9 10 > **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/expressions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. 11 12 _Expressions_ are used to refer to or compute values within a configuration. 13 The simplest expressions are just literal values, like `"hello"` or `5`, 14 but the Terraform language also allows more complex expressions such as 15 references to data exported by resources, arithmetic, conditional evaluation, 16 and a number of built-in functions. 17 18 Expressions can be used in a number of places in the Terraform language, 19 but some contexts limit which expression constructs are allowed, 20 such as requiring a literal value of a particular type or forbidding 21 [references to resource attributes](/language/expressions/references#references-to-resource-attributes). 22 Each language feature's documentation describes any restrictions it places on 23 expressions. 24 25 You can experiment with the behavior of Terraform's expressions from 26 the Terraform expression console, by running 27 [the `terraform console` command](/cli/commands/console). 28 29 The other pages in this section describe the features of Terraform's 30 expression syntax. 31 32 - [Types and Values](/language/expressions/types) 33 documents the data types that Terraform expressions can resolve to, and the 34 literal syntaxes for values of those types. 35 36 - [Strings and Templates](/language/expressions/strings) 37 documents the syntaxes for string literals, including interpolation sequences 38 and template directives. 39 40 - [References to Values](/language/expressions/references) 41 documents how to refer to named values like variables and resource attributes. 42 43 - [Operators](/language/expressions/operators) 44 documents the arithmetic, comparison, and logical operators. 45 46 - [Function Calls](/language/expressions/function-calls) 47 documents the syntax for calling Terraform's built-in functions. 48 49 - [Conditional Expressions](/language/expressions/conditionals) 50 documents the `<CONDITION> ? <TRUE VAL> : <FALSE VAL>` expression, which 51 chooses between two values based on a bool condition. 52 53 - [For Expressions](/language/expressions/for) 54 documents expressions like `[for s in var.list : upper(s)]`, which can 55 transform a complex type value into another complex type value. 56 57 - [Splat Expressions](/language/expressions/splat) 58 documents expressions like `var.list[*].id`, which can extract simpler 59 collections from more complicated expressions. 60 61 - [Dynamic Blocks](/language/expressions/dynamic-blocks) 62 documents a way to create multiple repeatable nested blocks within a resource 63 or other construct. 64 65 - [Type Constraints](/language/expressions/type-constraints) 66 documents the syntax for referring to a type, rather than a value of that 67 type. Input variables expect this syntax in their `type` argument. 68 69 - [Version Constraints](/language/expressions/version-constraints) 70 documents the syntax of special strings that define a set of allowed software 71 versions. Terraform uses version constraints in several places.