github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/chunklist.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "chunklist - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-chunklist" 5 description: |- 6 The chunklist function splits a single list into fixed-size chunks, returning 7 a list of lists. 8 --- 9 10 # `chunklist` 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 `chunklist` splits a single list into fixed-size chunks, returning a list 17 of lists. 18 19 ```hcl 20 chunklist(list, chunk_size) 21 ``` 22 23 ## Examples 24 25 ``` 26 > chunklist(["a", "b", "c", "d", "e"], 2) 27 [ 28 [ 29 "a", 30 "b", 31 ], 32 [ 33 "c", 34 "d", 35 ], 36 [ 37 "e", 38 ], 39 ] 40 > chunklist(["a", "b", "c", "d", "e"], 1) 41 [ 42 [ 43 "a", 44 ], 45 [ 46 "b", 47 ], 48 [ 49 "c", 50 ], 51 [ 52 "d", 53 ], 54 [ 55 "e", 56 ], 57 ] 58 ```