github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/website/docs/language/functions/map.html.md (about)

     1  ---
     2  layout: "language"
     3  page_title: "map - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-collection-map"
     5  description: |-
     6    The map function constructs a map from some given elements.
     7  ---
     8  
     9  # `map` Function
    10  
    11  The `map` function is no longer available. Prior to Terraform v0.12 it was
    12  the only available syntax for writing a literal map inside an expression,
    13  but Terraform v0.12 introduced a new first-class syntax.
    14  
    15  To update an expression like `map("a", "b", "c", "d")`, write the following instead:
    16  
    17  ```
    18  tomap({
    19    a = "b"
    20    c = "d"
    21  })
    22  ```
    23  
    24  The `{ ... }` braces construct an object value, and then the `tomap` function
    25  then converts it to a map. For more information on the value types in the
    26  Terraform language, see [Type Constraints](/docs/language/expressions/types.html).
    27  
    28  ## Related Functions
    29  
    30  * [`tomap`](./tomap.html) converts an object value to a map.
    31  * [`zipmap`](./zipmap.html) constructs a map dynamically, by taking keys from
    32    one list and values from another list.