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

     1  ---
     2  layout: "functions"
     3  page_title: "sort - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-collection-sort"
     5  description: |-
     6    The sort function takes a list of strings and returns a new list with those
     7    strings sorted lexicographically.
     8  ---
     9  
    10  # `sort` 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  `sort` takes a list of strings and returns a new list with those strings
    17  sorted lexicographically.
    18  
    19  The sort is in terms of Unicode codepoints, with higher codepoints appearing
    20  after lower ones in the result.
    21  
    22  ## Examples
    23  
    24  ```
    25  > sort(["e", "d", "a", "x"])
    26  [
    27    "a",
    28    "d",
    29    "e",
    30    "x",
    31  ]
    32  ```