Files
opentf/website/docs/configuration/functions/list.html.md
Nick Fagerlund 5e18e44037 Merge pull request #26723 from hashicorp/oct20_language_and_cli_docs
website: TF-153: Split core Terraform docs into "Language" and "CLI"
2020-11-11 19:31:05 -08:00

34 lines
1.1 KiB
Markdown

---
layout: "language"
page_title: "list - Functions - Configuration Language"
sidebar_current: "docs-funcs-collection-list"
description: |-
The list function constructs a list from some given elements.
---
# `list` Function
-> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and
earlier, see
[0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
The `list` function is no longer available. Prior to Terraform v0.12 it was
the only available syntax for writing a literal list inside an expression,
but Terraform v0.12 introduced a new first-class syntax.
To update an expression like `list(a, b, c)`, write the following instead:
```
tolist([a, b, c])
```
The `[ ... ]` brackets construct a tuple value, and then the `tolist` function
then converts it to a list. For more information on the value types in the
Terraform language, see [Type Constraints](../types.html).
## Related Functions
* [`concat`](./concat.html) produces a new list by concatenating together the
elements from other lists.
* [`tolist`](./tolist.html) converts a set or tuple value to a list.