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

     1  ---
     2  layout: "functions"
     3  page_title: "list - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-collection-list"
     5  description: |-
     6    The list function constructs a list from some given elements.
     7  ---
     8  
     9  # `list` 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 lists using the `[` and `]`
    17  delimiters. Use the built-in syntax instead. The `list` function will be
    18  removed in a future version of Terraform.
    19  
    20  `list` takes an arbitrary number of arguments and returns a list containing
    21  those values in the same order.
    22  
    23  ## Examples
    24  
    25  ```
    26  > list("a", "b", "c")
    27  [
    28    "a",
    29    "b",
    30    "c",
    31  ]
    32  ```
    33  
    34  Do not use the above form in Terraform v0.12 or above. Instead, use the
    35  built-in list construction syntax, which achieves the same result:
    36  
    37  ```
    38  > ["a", "b", "c"]
    39  [
    40    "a",
    41    "b",
    42    "c",
    43  ]
    44  ```
    45  
    46  ## Related Functions
    47  
    48  * [`tolist`](./tolist.html) converts a set value to a list.