github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/zipmap.mdx (about)

     1  ---
     2  page_title: zipmap - Functions - Configuration Language
     3  description: |-
     4    The zipmap function constructs a map from a list of keys and a corresponding
     5    list of values.
     6  ---
     7  
     8  # `zipmap` Function
     9  
    10  `zipmap` constructs a map from a list of keys and a corresponding list of
    11  values.
    12  
    13  ```hcl
    14  zipmap(keyslist, valueslist)
    15  ```
    16  
    17  Both `keyslist` and `valueslist` must be of the same length. `keyslist` must
    18  be a list of strings, while `valueslist` can be a list of any type.
    19  
    20  Each pair of elements with the same index from the two lists will be used
    21  as the key and value of an element in the resulting map. If the same value
    22  appears multiple times in `keyslist` then the value with the highest index
    23  is used in the resulting map.
    24  
    25  ## Examples
    26  
    27  ```
    28  > zipmap(["a", "b"], [1, 2])
    29  {
    30    "a" = 1,
    31    "b" = 2,
    32  }
    33  ```