uuid() and range(). All functions are evaluated at compile time from Resolved<T> inputs and locals — they don’t require cloud credentials, don’t make network calls, and produce values that are inlined directly into the generated Pulumi program. This tutorial is a complete reference with one working example per function, grouped by category, so you can find the function you need and see exactly what it produces.
What you’ll learn
- All 55 built-in functions organised by category
- The input and output type of each function
- How functions compose in
localblocks and resource attributes
Why this matters
Built-in functions eliminate the need for external scripting or complex workarounds for common operations. Instead of a separate Python script to compute a CIDR subnet,
cidrsubnet("10.0.0.0/16", 4, 2) does it inline. Instead of manually formatting a timestamp, formatdate("2006-01-02", timestamp()) produces the right string. Everything stays in .iac source.The source code
Function categories at a glance
| Category | Functions | Count |
|---|---|---|
| String | lower, upper, replace, trim, trimprefix, trimsuffix, trimspace, split, join, format, strlen, startswith, endswith, indent, chomp, regex, regexall | 17 |
| Collection | length, keys, values, merge, contains, lookup, flatten, distinct, slice, concat, reverse, sort, zipmap, toset, alltrue, anytrue | 16 |
| Type conversion | tostring, tonumber, tobool | 3 |
| Math | min, max, abs, ceil, floor | 5 |
| Encoding | jsonencode, jsondecode, base64encode, base64decode, yamlencode, yamldecode, urlencode, sha256, md5 | 9 |
| CIDR / networking | cidrsubnet, cidrhost, cidrnetmask, cidrprefix | 4 |
| Date / time | timestamp, formatdate | 2 |
| Filesystem | fileset | 1 |
| Misc | uuid, range | 2 |
| Total | 59 |
Common mistakes
Run it
What you learned
55 built-in functions are available across 8 categories — all evaluated at compile time
Functions cannot accept
Pending<T> values — only Resolved<T> inputs and localsFunctions compose naturally in
local blocks and resource attributesNext steps
Cross-stack same-repo
Reference outputs between stacks in the same repository
Locals
Where functions are most commonly used
Full runnable example: github.com/ubiquex/ubx-examples/57-built-in-functions-showcase

