is there a way to destroy a single resource with p...
# general
s
is there a way to destroy a single resource with pulumi inline? I'd love to be able to call a .delete() method to delete a temporary resourced after it's no longer needed
b
you can do targetted destroys with
--target {urn}
and there is also
--target-dependents
to tell it to destroy the children of your targets as well. Can get messy if there are a lot of children but if it is a resource that has no dependents it shouldn't be bad
l
A flag in code may be more appropriate. If the temporary resource is skipped (because it's in an if-statement or similar) then it will be destroyed the next time you
up
.
If you destroy it without removing it from the code then you risk 1. having it magically reappear at some point in the future, when Pulumi noticies it's missing from state and provider, and 2. having your code mislead people reading your code, because it's describing something other than reality.
b
you are correct, that would probably work better.