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