github.com/hugorut/terraform@v1.1.3/website/docs/configuration/expressions.mdx (about)

     1  ---
     2  page_title: Expressions Landing Page - Configuration Language
     3  ---
     4  
     5  # Expressions Landing Page
     6  
     7  To improve navigation, we've split the old Expressions page into several smaller
     8  pages.
     9  
    10  <a id="types-and-values"></a> <a id="advanced-type-details"></a> <a id="type-conversion"></a> <a id="literal-expressions"></a> <a id="indices-and-attributes"></a>
    11  
    12  ## Types and Values, Literal Expressions, Indices and Attributes
    13  
    14  Terraform's types are `string`, `number`, `bool`, `list`, `tuple`, `map`,
    15  `object`, and `null`.
    16  
    17  This information has moved to
    18  [Types and Values](/language/expressions/types).
    19  
    20  <div style={{height: '30vh', margin: 0, padding: 0}} />
    21  
    22  <a id="references-to-named-values"></a> <a id="local-named-values"></a> <a id="named-values-and-dependencies"></a> <a id="references-to-resource-attributes"></a> <a id="local-named-values-1"></a> <a id="values-not-yet-known"></a>
    23  
    24  ## References to Named Values (Resource Attributes, Variables, etc.)
    25  
    26  You can refer to certain values by name, like `var.some_variable` or
    27  `aws_instance.example.ami`.
    28  
    29  This information has moved to
    30  [References to Values](/language/expressions/references).
    31  
    32  <div style={{height: '30vh', margin: 0, padding: 0}} />
    33  
    34  <a id="arithmetic-operators"></a> <a id="equality-operators"></a> <a id="comparison-operators"></a> <a id="logical-operators"></a>
    35  
    36  ## Arithmetic and Logical Operators
    37  
    38  Operators are expressions that transform other expressions, like adding two
    39  numbers (`+`) or comparing two values to get a bool (`==`, `>=`, etc.).
    40  
    41  This information has moved to
    42  [Operators](/language/expressions/operators).
    43  
    44  <div style={{height: '30vh', margin: 0, padding: 0}} />
    45  
    46  ## Conditional Expressions
    47  
    48  The `condition ? true_val : false_val` expression chooses between two
    49  expressions based on a bool condition.
    50  
    51  This information has moved to
    52  [Conditional Expressions](/language/expressions/conditionals).
    53  
    54  <div style={{height: '30vh', margin: 0, padding: 0}} />
    55  
    56  <a id="expanding-function-arguments"></a> <a id="available-functions"></a>
    57  
    58  ## Function Calls
    59  
    60  Terraform's functions can be called like `function_name(arg1, arg2)`.
    61  
    62  This information has moved to
    63  [Function Calls](/language/expressions/function-calls).
    64  
    65  <div style={{height: '30vh', margin: 0, padding: 0}} />
    66  
    67  <a id="for-expressions"></a>
    68  
    69  ## `for` Expressions
    70  
    71  Expressions like `[for s in var.list : upper(s)]` can transform a complex type
    72  value into another complex type value.
    73  
    74  This information has moved to
    75  [For Expressions](/language/expressions/for).
    76  
    77  <div style={{height: '30vh', margin: 0, padding: 0}} />
    78  
    79  <a id="splat-expressions"></a> <a id="legacy-attribute-only-splat-expressions"></a>
    80  
    81  ## Splat Expressions
    82  
    83  Expressions like `var.list[*].id` can extract simpler collections from complex
    84  collections.
    85  
    86  This information has moved to
    87  [Splat Expressions](/language/expressions/splat).
    88  
    89  <div style={{height: '30vh', margin: 0, padding: 0}} />
    90  
    91  <a id="dynamic-blocks"></a> <a id="best-practices-for-dynamic-blocks"></a>
    92  
    93  ## `dynamic` Blocks
    94  
    95  The special `dynamic` block type serves the same purpose as a `for` expression,
    96  except it creates multiple repeatable nested blocks instead of a complex value.
    97  
    98  This information has moved to
    99  [Dynamic Blocks](/language/expressions/dynamic-blocks).
   100  
   101  <div style={{height: '30vh', margin: 0, padding: 0}} />
   102  
   103  <a id="string-literals"></a> <a id="string-templates"></a> <a id="interpolation"></a> <a id="directives"></a>
   104  
   105  ## String Literals and String Templates
   106  
   107  Strings can be `"double-quoted"` or
   108  
   109  ```hcl
   110  <<EOT
   111  heredocs
   112  EOT
   113  ```
   114  
   115  Strings can also include escape sequences like `\n`, interpolation sequences
   116  (`${ ... }`), and template sequences (`%{ ... }`).
   117  
   118  This information has moved to
   119  [Strings and Templates](/language/expressions/strings).
   120  
   121  <div style={{height: '30vh', margin: 0, padding: 0}} />