Mainly redefine or reused what Terraform did. * allow to used `variables`, `variable` and `local` blocks * import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
785 B
785 B
layout, page_title, sidebar_current, description
layout | page_title | sidebar_current | description |
---|---|---|---|
docs | coalesce - Functions - Configuration Language | configuration-functions-collection-coalesce-x | The coalesce function takes any number of arguments and returns the first one that isn't null nor empty. |
coalesce
Function
coalesce
takes any number of arguments and returns the first one
that isn't null or an empty string.
Examples
> coalesce("a", "b")
a
> coalesce("", "b")
b
> coalesce(1,2)
1
To perform the coalesce
operation with a list of strings, use the ...
symbol to expand the list as arguments:
> coalesce(["", "b"]...)
b
Related Functions
coalescelist
performs a similar operation with list arguments rather than individual arguments.