github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/coalescelist.mdx (about)

     1  ---
     2  page_title: coalescelist - Functions - Configuration Language
     3  description: |-
     4    The coalescelist function takes any number of list arguments and returns the
     5    first one that isn't empty.
     6  ---
     7  
     8  # `coalescelist` Function
     9  
    10  `coalescelist` takes any number of list arguments and returns the first one
    11  that isn't empty.
    12  
    13  ## Examples
    14  
    15  ```
    16  > coalescelist(["a", "b"], ["c", "d"])
    17  [
    18    "a",
    19    "b",
    20  ]
    21  > coalescelist([], ["c", "d"])
    22  [
    23    "c",
    24    "d",
    25  ]
    26  ```
    27  
    28  To perform the `coalescelist` operation with a list of lists, use the `...`
    29  symbol to expand the outer list as arguments:
    30  
    31  ```
    32  > coalescelist([[], ["c", "d"]]...)
    33  [
    34    "c",
    35    "d",
    36  ]
    37  ```
    38  
    39  ## Related Functions
    40  
    41  * [`coalesce`](/language/functions/coalesce) performs a similar operation with string
    42    arguments rather than list arguments.