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

breezy-book-15761

08/30/2022, 7:51 AM
Hello, is there a way to tell pulumi that you want to delete something?
s

steep-toddler-94095

08/30/2022, 7:53 AM
you can delete something by having your code not generate that resource anymore
b

breezy-book-15761

08/30/2022, 7:54 AM
yeah the thing is that it's not a resource I created
it's an automatically created resource, and I want to remove it
s

steep-toddler-94095

08/30/2022, 7:56 AM
if it's not tracked in Pulumi state, then pulumi cannot delete it Let's say you had Pulumi create a k8s Service and creates a corresponding ALB. You can "have Pulumi delete" the ALB by changing your Service to not be associated with a Cloud LB, but it's not Pulumi that's deleting the resource - it's whatever integration that created the resource in the first place.
b

breezy-book-15761

08/30/2022, 7:57 AM
yeah exactly but not possible here
would be great though
that way I could get out of ansible for this use case
l

little-cartoon-10569

08/30/2022, 8:53 PM
You can do it by importing the resource but not adding the generated code to your code base. That will put the resource in state; when you next run
up
, Pulumi will see the difference and remove the resource.
You can even do it in a reusable dummy project with a stack but no resources. It would work with any resource that can be imported.
2 Views