Is there a way to destroy only a resource from a s...
# general
Is there a way to destroy only a resource from a stack? cannot find any option in the docs:
Pretty sure if you comment it out of the code and then pulumi up it will delete the removed resource
Yes - commenting out and then `update`ing is generally the best way to do this if it can work since it retains the code matching the desired state of your infrastructure. However, there is also a
pulumi state delete '<urn>'
command which can force delete a resource out of your state file. This will not take care or deleting from your cloud provider - so you would need to manually do that yourself. And then if you haven't changed your code, the resource would get recreated on the next
@shy-army-45455, @white-balloon-205 thanks for the replies. Commenting out the code is more a workaround and does not scale well with a big infrastructure with dependencies
actually would be nice to have an option in the 'pulumi destroy -resource resource_name'
pulumi destroy -resource resource_name
Yes - this is something we could support in the future. Just to make sure, you want that to delete the resource in the cloud provider, but then you want a
pulumi update
immediately afterward to re-create it?
yes, I want to delete it and all dependencies in the cloud provider and then recreate it using pulumi up
Okay - that makes sense. I've added this to which was tracking the same thing for update and refresh as well, but we should include destroy as well when we implement that.
ok, thanks, let's hope someone will pick it up