import block tells ubx that a resource already exists in your cloud account and should be brought under management rather than created from scratch. ubx translates it to pulumi import semantics — Pulumi reads the live state of the resource and records it in the stack’s state file without triggering a create.
Syntax
<label> is an arbitrary identifier that groups related import entries. It has no semantic effect on deployment — it is organizational.
<binding> must match a resource binding name declared inside the stack {} body. It is an error if it does not match a declared binding.
Value types
String — single resource
The most common case: one existing resource mapped to one binding.opts=pulumi.ResourceOptions(import_="vpc-0abc1234def56789a") on the resource.
List — count-based fan-out
When a binding represents multiple resources (a count or list), provide a list of cloud IDs. ubx generates one resource per element, naming them<binding>-0, <binding>-1, etc.
Object — named map
When a binding represents a named collection, provide an object mapping logical keys to cloud IDs. ubx generates one resource per key, naming them<binding>-<key>.
Combining with provider
When a resource also declares a provider meta-argument, the two are merged into a single ResourceOptions:
Multiple blocks for the same label
Multipleimport blocks with the same label are merged. This lets you split a large import set across multiple files or add imports without touching an existing file.
Placement
import blocks are top-level. They can appear in any .xcl file in the compilation unit — not inside a stack {} body.
The recommended pattern is a dedicated file:
Validation rules
| Rule | Error |
|---|---|
| Value is not a string, list, or object literal | import "label": entry "name" value must be a string, list, or object literal |
| Duplicate binding name within one block | import "label": duplicate entry "name" |
| Duplicate binding name across merged blocks | import "label": duplicate entry "name" across merged blocks |
| Value contains a non-string element in a list | Build error — list elements must be string literals |
| Value contains a non-string value in an object | Build error — object values must be string literals |
Relationship to Pending<T>
Import values must be string literals. Pending references (~resource.attr) are not allowed — the cloud resource ID must be known at compile time.
Relationship to import "path"
XCL also uses import for module imports — bringing names from another .xcl file into scope:
{. The parser distinguishes them by lookahead and there is no ambiguity.
After onboarding
Onceubx ship runs successfully with the import blocks present, the resources are recorded in Pulumi state. At that point:
- Delete the
imports.xclfile (or remove theimportblocks from wherever they live). - Run
ubx shipagain. Pulumi will no longer attempt to import — it will manage the resources normally.

