Is it possible in pulumi to create a temporary res...
# general
b
Is it possible in pulumi to create a temporary resource ? Consider a situation where you need to provision a resource that is useful only during provisioning of another resource. How to deal with that? Example situation: I want to provision some "state" into a persistent volume that is later used by some containers. In order to provision that data I'd like to 1) create temporary EC2 instance, 2) attach and mount that volume to that ec2 instance 3) run some scripts that provision some data 4) detach volume & delete temporary EC2 instance
b
I think in this scenario you would have 2 projects, one of which being the project that contains your temporary infrastructure. So you'd
pulumi up
the first project, do your external scripts / work,
pulumi up
the 2nd project, and then
pulumi destroy
the first. You could do all that using the CLI I think, but you could also leverage Automation API to orchestrate
b
yeah I could use some direct API (like boto3 in python) and do my stuff in some function that gets executed during pulumi processing but there I would need to reinvent lot of low level stuff that is sorted by pulumi resource libraries
and spliting it to two project implies a manual step or slapping some glue layer on top and avoiding this is one reason why I use pulumi 🙂
b
well the Automation API would alleviate that. Nothing manual about it, you could have a single console app that does all of those steps and is run all at once in your CI/CD.
b
@bored-oyster-3147 thanks, will check the Automation API out 🙂