terraform/website/docs/language/functions/chunklist.mdx

54 lines
632 B
Plaintext
Raw Normal View History

---
2021-11-23 00:47:36 +01:00
page_title: chunklist - Functions - Configuration Language
description: |-
The chunklist function splits a single list into fixed-size chunks, returning
a list of lists.
2021-11-23 00:47:36 +01:00
sidebar_title: chunklist
---
# `chunklist` Function
`chunklist` splits a single list into fixed-size chunks, returning a list
of lists.
```hcl
chunklist(list, chunk_size)
```
## Examples
```
> chunklist(["a", "b", "c", "d", "e"], 2)
[
[
"a",
"b",
],
[
"c",
"d",
],
[
"e",
],
]
> chunklist(["a", "b", "c", "d", "e"], 1)
[
[
"a",
],
[
"b",
],
[
"c",
],
[
"d",
],
[
"e",
],
]
```