Pulumi "import" Fails - Wrong Resource ID or Mismatched Props
Pulumi could not bring an existing cloud resource under management. The import ID was wrong for that resource type, the resource does not exist in the targeted account/region, or the generated inputs do not match reality.
What this error means
pulumi import <type> <name> <id> fails with a not-found error, or it succeeds but the very next preview wants to replace the resource because the imported inputs differ from the live properties. It is deterministic for a given ID and program.
error: Preview failed: importing id "i-0bad": resource 'i-0bad' does not exist
# or, after a "successful" import:
~ aws:ec2:Instance web replace [diff: ~instanceType ~subnetId]Common causes
Wrong ID format or wrong account/region
Each resource type expects a specific import ID shape (an ARN, an instance id, a name/zone pair). A malformed ID - or the right ID in the wrong region/account - resolves to nothing.
Program inputs do not match the live resource
Import generates a resource definition, but if your program’s inputs differ from the resource’s actual properties, the next up plans a replace to make reality match the program.
How to fix it
Use the correct import ID and target
Look up the exact ID format for the resource type and confirm the provider is pointed at the right account/region before importing.
pulumi import aws:ec2/instance:Instance web i-0123456789abcdef0 \
--stack org/proj/dev # ensure aws:region matches where the instance livesReconcile the generated inputs
- Copy the resource definition Pulumi prints on import into your program.
- Run
pulumi preview --diffand adjust your inputs until there is no replace/update. - Use
protectorignoreChangesonly for properties you intentionally do not manage.
How to prevent it
- Confirm the exact import ID format per resource type in the provider docs.
- Import into a stack whose provider targets the resource’s account and region.
- Always
preview --diffafter import and reconcile before applying.