Hello everyone! I'm writing a python+fastAPI api l...
# general
t
Hello everyone! I'm writing a python+fastAPI api leveraging pulumi's automation API deploying/destroying digitalocean droplets and have hit a bit of a wall trying to wrap my head around the destroy part of things. to make a long story short - how do i destroy resources from a specific stack? using the cli, i could do > pulumi destroy --target urn_here how can i do the same with the automation api? im using python but any language would be useful
f
that's a tough one; my gut instinct is to run your stack-definition program and simply not return / register the resource that you don't want to exist; but that sounds like it doesn't quite mesh with your workflow
t
first, thanks for the reply! but yea, that doesnt work too well for my workflow. for some added context in case it help: these droplets are managed instances by my company. if a client would like to unsubscribe to our services, i want our server to send a request to this api im writing and then destroy the droplet and delete it from our state. it would be awesome to pass the urn/name/id into a stack function that removes it. for example stack.delete(<argument_here>).
as far as i can tell, the only destroy function the api exposes is stack.destroy? is that correct?
m
Why don't you deploy a stack per customer? You can create your base infrastructure and then use a second program to create a smaller stack per client that references the base infrastructure. This way, you can create, update, and destroy the client-specific resources independently.