Hello the great Pulumi community, In one of my si...
# automation-api
f
Hello the great Pulumi community, In one of my side project, I need to destroy ephemeral infrastructures and when I destroy them, I also want to remove the associated config files (state). These files are empties, and it's better to remove them from the bucket dedicated to testing. With Pulumi automation, I didn't find, in the destroy method, a way to pass the --remove option I saw a method remove_config, but it allows to delete a key from config but not the config file itself. I am using the Python sdk for Pulumi automation Do you know if it's possible to remove the stack and the config files with the Automation API and the Python SDK ? With the CLI it's possible via the --remove option when we invoke the destroy command : https://www.pulumi.com/docs/cli/commands/pulumi_destroy/ Thanks for your help 🙏
l
Hi Mazlum. I don't think it's possible right now. There's actually a year-old PR to sort this (https://github.com/pulumi/pulumi/pull/11080) that I'm trying to get over the line at the moment, but unfortunately it's not possible just yet.
f
Hi Will. Thanks for your help 🙏 Your PR is for NodeJs not for the Python SDK, right ?
I have a solution now, but it's not elegant. I overloaded the "destroy" method from the Stack class and added the argument "remove" by myself. I will submit a PR after to help the community. If there is another solution now, I'll take it 🙂
m
Noice @full-cpu-27588!
👍 1
f
To have a better and total control on this issue, I will use the BigQuery Python client to remove the empty state files on my side. Instead of override the "destroy" method. After submitted the PR or when this feature will be available, I will use it in my project.
l
Hey Mazlum, just an update on this. https://github.com/pulumi/pulumi/pull/16674 should land soon and hopefully make it into the next release (likely 3.125.0, which hopefully will be out this week).
(This covers the NodeJS, Python and Go SDKs)