Skip to content
Latchkey

Pulumi "resource ... does not exist" drift in CI

Pulumi tried to read or update a resource its state says exists, but the cloud API reports it is gone. Something deleted the resource outside Pulumi, so state and reality have drifted apart.

What this error means

A pulumi up or pulumi refresh step fails with "error: resource 'X' does not exist" or a provider "NotFound" while operating on a resource in state.

pulumi
error: aws:ec2/instance:Instance resource 'web' does not exist;
the instance ID i-0abc123 was not found

Common causes

The resource was deleted outside Pulumi

A console action, another tool, or a separate stack removed the resource, but Pulumi state still references it.

State points at a resource in another account or region

Credentials or region changed, so the resource exists elsewhere and is not found where Pulumi looks.

How to fix it

Refresh state to reconcile drift

  1. Run pulumi refresh to update state to match the cloud.
  2. Review what refresh proposes to remove from state.
  3. Re-run pulumi up so the resource is recreated if the program still declares it.
Terminal
pulumi refresh --yes
pulumi up --yes

Confirm credentials and region match the state

Ensure the job targets the same account and region the resource lives in so it is found.

Terminal
pulumi config set aws:region us-east-1

How to prevent it

  • Manage resources through Pulumi, not the console, to avoid drift.
  • Run pulumi refresh in CI before applying when drift is possible.
  • Keep credentials and region stable across runs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →