github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/zipmap.html.md (about)

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