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

bored-table-20691

05/24/2021, 8:26 PM
Is it possible to configure a resource to be “abandoned” on destroy (i.e. not deleted)? Specifically, I want the state for it to be gone if I do a
pulumi destroy
, but I don’t want the actual resource deleted. An example would be a per-tenant S3 bucket or a database in an RDS instance (where each tenant gets a stack) that houses some data, so that once it is created it won’t get removed, even if I destroy the stack, since this might have some user data that I want to not delete by default. Ideally this would be automatic, i.e. I wouldn’t have to do anything by hand (i.e. manually delete it from the state file). Looking through the docs and Slack history, I couldn’t see an answer, so thought I’d ask here.
b

billowy-army-68599

05/24/2021, 8:29 PM
this isn't really possible at this time I'm afraid
b

bored-table-20691

05/24/2021, 8:43 PM
Thanks @billowy-army-68599 - that was my assumption given the docs didn’t mention anything, so I’ll have to live with it.
Is it something that would be possible to do in the automation API (i.e. delete the reference to that resource in the stack as part of an automated destroy)? I’m not really sure I want to go down that route but thought I’d check.
b

billowy-army-68599

05/24/2021, 8:44 PM
something to consider: it sounds like basically you want to create an S3 bucket that you "abandon" from the state - if you always want to do that, you could provision the S3 bucket using the standard AWS SDK in the automation API
it should be possible to have the state delete in the automation API i think, but you'll need to open a feature request for it
b

bored-table-20691

05/24/2021, 8:46 PM
@billowy-army-68599 indeed - that’s easy enough for an S3 bucket, but a bit harder for something like a Postgres database - have to set up connectivity for it, etc. It would also be a bit odd with previews and so on, since that part of provisioning would execute every time, since in Go we do not have dynamic provisioners.
b

billowy-army-68599

05/24/2021, 8:47 PM
yeah i totally get it, i don't think there's a great answer 😞 your best bet would be to segment the projects and on;y run destroy on the resources you definitely want to destroy, I think
b

bored-table-20691

05/24/2021, 8:48 PM
Yep, makes sense. It is what it is, not the end of the world 🙂