github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/tomap.html.md (about) 1 --- 2 layout: "language" 3 page_title: "tomap - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-conversion-tomap" 5 description: |- 6 The tomap function converts a value to a map. 7 --- 8 9 # `tomap` Function 10 11 `tomap` converts its argument to a map value. 12 13 Explicit type conversions are rarely necessary in Terraform because it will 14 convert types automatically where required. Use the explicit type conversion 15 functions only to normalize types returned in module outputs. 16 17 ## Examples 18 19 ``` 20 > tomap({"a" = 1, "b" = 2}) 21 { 22 "a" = 1 23 "b" = 2 24 } 25 ``` 26 27 Since Terraform's concept of a map requires all of the elements to be of the 28 same type, mixed-typed elements will be converted to the most general type: 29 30 ``` 31 > tomap({"a" = "foo", "b" = true}) 32 { 33 "a" = "foo" 34 "b" = "true" 35 } 36 ```