github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/map.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "map - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-map" 5 description: |- 6 The map function constructs a map from some given elements. 7 --- 8 9 # `map` Function 10 11 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 12 earlier, see 13 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 14 15 ~> **This function is deprecated.** From Terraform v0.12, the Terraform 16 language has built-in syntax for creating maps using the `{` and `}` 17 delimiters. Use the built-in syntax instead. The `map` function will be 18 removed in a future version of Terraform. 19 20 `map` takes an even number of arguments and returns a map whose elements 21 are constructed from consecutive pairs of arguments. 22 23 ## Examples 24 25 ``` 26 > map("a", "b", "c", "d") 27 { 28 "a" = "b" 29 "c" = "d" 30 } 31 ``` 32 33 Do not use the above form in Terraform v0.12 or above. Instead, use the 34 built-in map construction syntax, which achieves the same result: 35 36 ``` 37 > {"a" = "b", "c" = "d"} 38 { 39 "a" = "b" 40 "c" = "d" 41 } 42 ``` 43 44 ## Related Functions 45 46 * [`tomap`](./tomap.html) performs a type conversion to a map type.