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