ubx { } block as a standalone config source. But what about projects that already have a ubx.yaml and want to gradually adopt the block syntax, or projects that use YAML for static config and .iac blocks for dynamic config? ubx supports both simultaneously — when it finds both ubx.yaml and a ubx { } block in the same project, it merges them. The .iac block wins on any key that appears in both. Keys present only in ubx.yaml are inherited unchanged. Keys present only in the ubx { } block are applied as additions. The result is a unified config that combines both sources, with a clear ℹ info message printed during compilation to confirm both sources are active. This makes dual-format projects transparent rather than silently surprising.
What you’ll learn
- How
ubx.yamland aubx { }block merge when both are present - The precedence rule:
.iacwins on overlap, YAML fills in what.iacdoesn’t declare - The
ℹinfo message that confirms both sources are active
Why this matters
The merge behaviour enables incremental adoption. A project with an existing
ubx.yaml can start adding ubx { } blocks for specific features — AI config, dynamic scan.enabled — without having to migrate the entire config at once. YAML handles the static stuff; the block handles the dynamic stuff.The source code
How it works
ubx detects both sources and prints an info message
When both
ubx.yaml and a ubx { } block are found, ubx prints: ℹ ubx block in .iac overrides ubx.yaml — both config sources are active. This is always shown — it’s not a warning, just a confirmation that the merge is in effect..iac wins on overlapping keys
runtime = "typescript" in the ubx { } block overrides runtime: python in ubx.yaml. The final resolved runtime is typescript. ubx.yaml’s runtime: python is silently superseded.Merge result — what the compiler sees
| Key | Source | Final value |
|---|---|---|
name | ubx.yaml | "ubx-block-vs-ubx-yaml-merge" |
runtime | ubx { } (wins) | "typescript" |
description | ubx.yaml | "Shows merge precedence..." |
tags.team | ubx.yaml | "platform" |
tags.env | ubx { } | "dev" (or current env) |
team and env tags on every resource.
Common mistakes
Run it
What you learned
When both
ubx.yaml and a ubx { } block are present, ubx merges them — .iac wins on overlapNon-overlapping keys from each source are preserved additively
The
ℹ info message always confirms that both sources are activeNext steps
ubx block reference
Full ubx block syntax, all sub-blocks, and the merge specification
Configuration as code
Using ubx block as the sole config source
Full runnable example: github.com/ubiquex/ubx-examples/46-ubx-block-vs-ubx-yaml-merge

