Skip to content
Latchkey

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.

pulumi output
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.

Terminal
pulumi import aws:ec2/instance:Instance web i-0123456789abcdef0 \
  --stack org/proj/dev   # ensure aws:region matches where the instance lives

Reconcile the generated inputs

  1. Copy the resource definition Pulumi prints on import into your program.
  2. Run pulumi preview --diff and adjust your inputs until there is no replace/update.
  3. Use protect or ignoreChanges only 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 --diff after import and reconcile before applying.

Frequently asked questions

What causes ""pulumi import" failed"?
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.
How do I fix "pulumi import" failed?
Look up the exact ID format for the resource type and confirm the provider is pointed at the right account/region before importing.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card