Pulumi — State Delete and Unprotect
Remove resources from state or remove protection.
Delete from State
If a cloud resource was deleted manually and Pulumi still tracks it:
$ pulumi state delete 'urn:pulumi:dev::my-infra::aws:s3/bucket:Bucket::data'
This removes the resource from Pulumi’s state without deleting the cloud resource.
Find the URN
# List all resources and their URNs
$ pulumi stack export | jq '.deployment.resources[].urn'
Or from pulumi stack:
$ pulumi stack --show-urns
Unprotect a Resource
If a resource is protected, unprotect it before deleting:
$ pulumi state unprotect 'urn:pulumi:dev::my-infra::aws:rds/instance:Instance::prod-db'
Then you can destroy it normally:
$ pulumi destroy --target 'urn:...'
Comparison with Terraform
# Terraform state rm
terraform state rm aws_s3_bucket.data
# Pulumi state delete
pulumi state delete 'urn:pulumi:dev::my-infra::aws:s3/bucket:Bucket::data'
What’s Next?
Sync state with the real world using pulumi refresh.