https://pulumi.com logo
#general
Title
# general
r

rough-rain-68282

10/06/2021, 11:33 AM
Hello, I accidentally manually deleted a resource created by pulumi infrastructure, I am sure that the resource I delete doesnt have dependency on any other resource. Can I use "pulumi delete state 'urn of the resource I deleted' " to get rid of it from the state ?
p

prehistoric-activity-61023

10/06/2021, 11:45 AM
I’d try to run
pulumi refresh
to refresh the pulumi state based on the current state in the cloud. You can backup the state just in case using
pulumi stack export
.
r

rough-rain-68282

10/06/2021, 11:50 AM
I get this error for any commands I will try
Copy code
.pulumi/stacks/Staging.json: snapshot integrity failure; refusing to use it
the cloud state currently doesnt match the state in the Staging.json as the resource in cloud was deleted manually
m

millions-furniture-75402

10/06/2021, 1:02 PM
you can
pulumi stack export
then modify the stack.json to reflect reality, and then
cat stack.json | pulumi stack import
r

rough-rain-68282

10/06/2021, 1:31 PM
Thanks let me try the same
@millions-furniture-75402 I have got the json file with the correct state, the latest file being referred for state is in s3 bucket. Would replacing the state json in the s3 bucket with the one I want work?
m

millions-furniture-75402

10/06/2021, 1:50 PM
Why wouldn't you use
pulumi stack import
?
r

rough-rain-68282

10/06/2021, 2:31 PM
well replacing old state json file with the correct state file worked for me, I just replaced it in s3 bucket with same name
👍 1
Thanks @millions-furniture-75402
2 Views