github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/transpose.html.md (about)

     1  ---
     2  layout: "functions"
     3  page_title: "transpose - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-collection-transpose"
     5  description: |-
     6    The transpose function takes a map of lists of strings and swaps the keys
     7    and values.
     8  ---
     9  
    10  # `transpose` Function
    11  
    12  -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and
    13  earlier, see
    14  [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
    15  
    16  `transpose` takes a map of lists of strings and swaps the keys and values
    17  to produce a new map of lists of strings.
    18  
    19  ## Examples
    20  
    21  ```
    22  > transpose({"a" = ["1", "2"], "b" = ["2", "3"]})
    23  {
    24    "1" = [
    25      "a",
    26    ],
    27    "2" = [
    28      "a",
    29      "b",
    30    ],
    31    "3" = [
    32      "b",
    33    ],
    34  }
    35  ```