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

creamy-monkey-35142

09/18/2023, 3:14 AM
I’m using Cloudflare tunnel with Pulumi and I have a code block to add tunnel secret into pulumi stack config if secret didn’t exist:
Copy code
stack.set_config(f"{type}-{name}", auto.ConfigValue(value=tunnel_secret, secret=True))
This is done for newly create tunnel but how I remove this secret when tunnel being deleted? in other words, how I detect
delete
action to perform remove stack config?
l

little-cartoon-10569

09/18/2023, 5:33 AM
You don't. Under what circumstances would the tunnel be destroyed? Would it be just when the stack is being destroyed? In which case, you can just remove the stack config, as it's not being used.
c

creamy-monkey-35142

09/18/2023, 5:37 AM
I can understand that there is no way to automate it
e

echoing-dinner-19531

09/18/2023, 7:49 AM
How are you detecting the create action? I'd think you'd just be able to do the opposite of that
c

creamy-monkey-35142

09/18/2023, 7:52 AM
I’m not sure about that because I have a code block to create resource but there is no option to define code block to delete resource
e

echoing-dinner-19531

09/18/2023, 8:34 AM
It deletes when you remove the code block
2 Views