github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/coalesce.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "coalesce - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-coalesce-x" 5 description: |- 6 The coalesce function takes any number of arguments and returns the 7 first one that isn't null nor empty. 8 --- 9 10 # `coalesce` 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 `coalesce` takes any number of arguments and returns the first one 17 that isn't null or an empty string. 18 19 ## Examples 20 21 ``` 22 > coalesce("a", "b") 23 a 24 > coalesce("", "b") 25 b 26 > coalesce(1,2) 27 1 28 ``` 29 30 To perform the `coalesce` operation with a list of strings, use the `...` 31 symbol to expand the list as arguments: 32 33 ``` 34 > coalesce(["", "b"]...) 35 b 36 ``` 37 38 ## Related Functions 39 40 * [`coalescelist`](./coalescelist.html) performs a similar operation with 41 list arguments rather than individual arguments.