github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/collection/keys.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: keys - Functions - Configuration Language
     4  sidebar_title: keys
     5  description: The keys function returns a list of the keys in a given map.
     6  ---
     7  
     8  # `keys` Function
     9  
    10  `keys` takes a map and returns a list containing the keys from that map.
    11  
    12  The keys are returned in lexicographical order, ensuring that the result will
    13  be identical as long as the keys in the map don't change.
    14  
    15  ## Examples
    16  
    17  ```shell-session
    18  > keys({a=1, c=2, d=3})
    19  [
    20    "a",
    21    "c",
    22    "d",
    23  ]
    24  ```
    25  
    26  ## Related Functions
    27  
    28  - [`values`](/docs/job-specification/hcl2/functions/collection/values) returns a list of the _values_ from a map.