github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/compact.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "compact - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-compact" 5 description: |- 6 The compact function removes empty string elements from a list. 7 --- 8 9 # `compact` Function 10 11 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 12 earlier, see 13 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 14 15 `compact` takes a list of strings and returns a new list with any empty string 16 elements removed. 17 18 ## Examples 19 20 ``` 21 > compact(["a", "", "b", "c"]) 22 [ 23 "a", 24 "b", 25 "c", 26 ] 27 ```