import block annotates a unit block so Pulumi adopts an already-existing cloud resource instead of creating a new one. Equivalent to Terraform’s import block.
Syntax
unit block exactly. Only id is allowed — any other attribute is a compile error.
Example
id Must be Resolved
The id attribute must be Resolved<T> — a plain string or input reference. Cloud resource IDs must be known before apply starts:
Combined with lifecycle
Error Cases
| Situation | Error |
|---|---|
id is missing | import block "T" "N" requires an "id" attribute |
id is Pending<T> | the import block "id" must be a resolved value |
No matching unit block | import "T" "N" requires a matching unit block |
Duplicate import | import "T" "N" is declared more than once |
