github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/tolist.html.md (about) 1 --- 2 layout: "language" 3 page_title: "tolist - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-conversion-tolist" 5 description: |- 6 The tolist function converts a value to a list. 7 --- 8 9 # `tolist` Function 10 11 `tolist` converts its argument to a list value. 12 13 Explicit type conversions are rarely necessary in Terraform because it will 14 convert types automatically where required. Use the explicit type conversion 15 functions only to normalize types returned in module outputs. 16 17 Pass a _set_ value to `tolist` to convert it to a list. Since set elements are 18 not ordered, the resulting list will have an undefined order that will be 19 consistent within a particular run of Terraform. 20 21 ## Examples 22 23 ``` 24 > tolist(["a", "b", "c"]) 25 [ 26 "a", 27 "b", 28 "c", 29 ] 30 ``` 31 32 Since Terraform's concept of a list requires all of the elements to be of the 33 same type, mixed-typed elements will be converted to the most general type: 34 35 ``` 36 > tolist(["a", "b", 3]) 37 [ 38 "a", 39 "b", 40 "3", 41 ] 42 ```