ubx.yaml, a YAML file separate from your .iac source. The ubx { } block is an equal alternative: the same configuration, expressed in .iac syntax alongside your resources. The advantage isn’t just aesthetics — the ubx { } block unlocks capabilities that YAML can’t express. You can reference resource outputs inside it, making scan.enabled a Pending<T> value that resolves from a feature flag stored in SSM Parameter Store. You can use conditional expressions to vary settings by environment. You can use extend "ubx" { } in an environment override file to change AI settings or scan severity in prod without touching the base config. Config as code, not config as YAML.
What you’ll learn
- How to express all project config in a
ubx { }block instead ofubx.yaml - The sub-blocks:
tags,ai,scan,history,telemetry - How
scan.enabledcan be aPending<T>value referencing a resource output
Why this matters
The
ubx { } block and ubx.yaml are permanent equals — neither is deprecated. Choose the one that fits your project. Use ubx { } when you want config close to your resources, conditional config based on inputs, or pending resource references in config values. Use ubx.yaml when you prefer explicit YAML or when your config is completely static.The source code
How it works
The ubx block is parsed and merged into Viper config
During
initConfig(), ubx reads the ubx { } block from .iac files alongside ubx.yaml (if present). The .iac block wins on any overlapping keys. Both sources are active simultaneously — this is the merge, not a replacement.Resolved attributes are applied immediately
runtime, default_env, version, name, and literal tag values are Resolved<T> — they’re applied to the Viper config immediately. The stack validates against these resolved values as if they came from ubx.yaml.ubx block sub-blocks reference
| Sub-block | Purpose |
|---|---|
tags { } | Shared tags applied to all resources; supports resource output refs and interpolation |
ai { } | AI feature flags: enabled, model, features |
scan { } | Security scan config: enabled (can be Pending<T>), severity |
history { } | Apply history: enabled |
telemetry { } | Opt-in telemetry: enabled, endpoint |
Common mistakes
Run it
What you learned
The
ubx { } block is a full alternative to ubx.yaml — both are permanently supportedSub-blocks
tags, ai, scan, history, telemetry cover all project-level settingsPending<T> values in config (like scan.enabled) are deferred to plan timeNext steps
ubx block vs ubx.yaml merge
What happens when both formats are present simultaneously
ubx block reference
Full ubx block syntax and all sub-blocks
Full runnable example: github.com/ubiquex/ubx-examples/45-ubx-block-config-as-code

