github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/website/docs/language/functions/keys.html.md (about) 1 --- 2 layout: "language" 3 page_title: "keys - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-keys" 5 description: |- 6 The keys function returns a list of the keys in a given map. 7 --- 8 9 # `keys` Function 10 11 `keys` takes a map and returns a list containing the keys from that map. 12 13 The keys are returned in lexicographical order, ensuring that the result will 14 be identical as long as the keys in the map don't change. 15 16 ## Examples 17 18 ``` 19 > keys({a=1, c=2, d=3}) 20 [ 21 "a", 22 "c", 23 "d", 24 ] 25 ``` 26 27 ## Related Functions 28 29 * [`values`](./values.html) returns a list of the _values_ from a map.