github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/tomap.mdx (about)

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