mirror of
https://github.com/hashicorp/terraform.git
synced 2026-05-16 19:39:42 -04:00
934 B
934 B
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| functions | coalesce - Functions - Configuration Language | docs-funcs-collection-coalesce-x | The coalesce function takes any number of string arguments and returns the first one that isn't empty. |
coalesce Function
-> Note: This page is about Terraform 0.12 and later. For Terraform 0.11 and earlier, see 0.11 Configuration Language: Interpolation Syntax.
coalesce takes any number of string arguments and returns the first one
that isn't empty.
Examples
> coalesce("a", "b")
a
> coalesce("", "b")
b
To perform the coalesce operation with a list of strings, use the ...
symbol to expand the list as arguments:
> coalesce(["", "b"]...)
b
Related Functions
coalescelistperforms a similar operation with list arguments rather than string arguments.