Pulumi "deleting ... resource ... still has dependents" in CI
Pulumi refused to delete a resource because other resources still depend on it. Removing it would leave the dependents referencing something that no longer exists, so the delete is blocked until the dependents are handled.
What this error means
A pulumi up or pulumi destroy step fails with "error: deleting resource 'X': ... still has dependents" and lists the URNs that depend on it.
error: deleting urn:pulumi:dev::app::aws:ec2/vpc:Vpc::main:
resource still has dependents:
urn:pulumi:dev::app::aws:ec2/subnet:Subnet::app-subnetCommon causes
Dependent resources are not being deleted together
The program still declares resources that reference the one you removed, so Pulumi cannot delete it while they exist.
A manual state edit left a dangling dependency
A partial state change removed a resource without removing what depends on it, leaving an inconsistent graph.
How to fix it
Remove or repoint the dependents first
- Identify the dependent URNs listed in the error.
- Delete or update those resources so they no longer reference the target.
- Re-run so the target can be removed.
Delete the dependent from state if it is truly gone
If a dependent no longer exists in the cloud, remove it from state so the parent can be deleted.
pulumi state delete 'urn:pulumi:dev::app::aws:ec2/subnet:Subnet::app-subnet'How to prevent it
- Delete resources through the program so dependency order is respected.
- Avoid manual state edits that leave dangling dependents.
- Model parent/child relationships explicitly so ordering is correct.