This message was deleted.
# general
s
This message was deleted.
šŸ¤” 1
āž• 1
s
You could use the Automation API -- create your own CLI with "up" and "destroy" commands, execute your own code then call "up" and "destroy" through the API. https://www.pulumi.com/docs/guides/automation-api/
šŸ™Œ 2
b
curious if the create/destroy are related to the same resource?
s
p
I have the same need… I’ll look into using the automation API, but it’d be simpler and easier for me if my regular project code could just ā€œknowā€ what’s happening when it’s called — if it’s going to be creating, importing, updating, or deleting a resource. Is there any way to detect this at runtime?
s
@powerful-room-57148 See the links I posted to pulumi-command, I've not used them before but I think it may get you what you want. If you look at the announcements channel, it is introduced in the February releases video. https://pulumi-community.slack.com/archives/CB36DSVSA/p1645654940467199
p
Thanks! I did see the links, and followed them, but in my case I don’t need to run an external command, I need to run local code (functions etc) in certain situations.
s
Ahh, gotcha -- though, if you wanted to really be hackish your "external command" could call and execute local code .... haha, holy-hack, but could be done : )
p
šŸ¤” I kinda wish I could attach some kind of preflight/postflight functions to resources, and if those functions were passed an arg with info about the operation (create/update/destroy) that’d get me all I need
lol yeah… 10 years ago I might have done something like that!
the maintenance overhead of that sort of thing… I don’t like leaving puzzles for whoever will inherit my project down the road šŸ˜‰
s
I agree 100%, it was mostly meant to solicit a good laugh.
p
success!
has anything along the lines of preflight/postflight functions been considered at any point?