what is the best option to see all urns ? I want t...
# general
g
what is the best option to see all urns ? I want to
destory
targets, but i have some config files that is created and when i do
preview --urns
then i don't see them and they don't get destroyed when i destroy a VM
nvm, i did
destroy --urns
and it gives me what i want 🙂
a
You can view the state
Copy code
pulumi stack export -s stack-name
destroy
works on the entire stack If you need to remove some resources, you need to update code to remove resource definition, and use
pulumi up --target urn
s
@glamorous-vr-10317 You don't generally want to destroy a specific target because you are subverting the declarative nature of Pulumi. Can you explain more about your workflow here?
g
sure @stocky-restaurant-98004 I'm super new to Pulumi, and i come from a world of Saltstack (tiny bit ansible). What I have written so far with this is to spin up vm's in my proxmox node "cluster". And i have basically just continued writing new stuff within this same project. So other VM's for new features. It's currently those i nuked. I haven't dug into how to make it more declarative.
a
In this case, you need to go back to delete code that provisions VMs you want to delete.
g
delete code?
s
You remove the declaration of the VM from the code.
g
🤔
ahh
so straight up remove it from my codebase
s
Whatever you have in your Pulumi code is saying "this is what I want the final state to be". The Pulumi engine will use your state file and diff it against your code and figure out what needs to change and in what order. This is what is meant by "declarative IaC".
👍 1
g
understandable.
ya, my destroy has just been because i messed stuff up. but didn't want to destroy the stuff that works
s
If you're working with VMs, especially long-lived ones, the benefits of declarative IaC aren't as great as if you were operating in a more cloud-native way, e.g. running containers.
But it can still be useful. You might want to look into how you can make your infrastructure more immutable. You might want to look into HashiCorp's Packer to create VM images that have all the updates and OS tweaks (use Saltstack or whatever you like there for configuration management) and then use Pulumi to deploy those images along with your workload (e.g. through Cloudinit if Proxmox supports it).
g
i have made it immutable. the basic config of the vm's is basically in
pulumi.dev.yaml
and they are booted with cloud-init. the actual configuration of the vm's will be ansible / saltstack.