I'm making my own framework/tool on top of pulumi/the automation API in python. Pulumi doesn't have support for verifying that old resources are setup before replacing them with new ones, making it impossible to have phoenix servers (cattle not pets) with zero downtime/without risk of stuff going down on a bad update. This article advocates for cattle not pets
https://www.pulumi.com/blog/deploy-wordpress-aws-pulumi-ansible/, but pulumi leaves gaps in it as is. I'm making this because I can not afford the possibility of deploying software (like a wordpress site for example), and having everything go down before a new server is ready, or having the old server gone because of a bad download or update. I raised a ticket about this issue with current pulumi capabilities here:
https://github.com/pulumi/pulumi/issues/20619 . This is not intended to be an advertisement and I'm doing this almost entirely for myself.
• Pulumi manages resource and there is no additional lifecycle beyond crud operations. I'm making a framework to add a layer of components in python code that will allow for putting resources in different stacks on a "super stack". (think pulumi_program() -> None) My model to solve this problem is that: You manage stacks on a super stack, stacks are the component system, you create a stack, add some resources, and can add provisioners to a stack component, a stack within a super stack will have it's own state within my tool, it will likely have a flag to say that it is done, based on all of the provisioners running, if any of them fail, a stack component will not be fit to replace an old component.
• The framework operates by taking a pulumi program function and capturing the information of every resource created. This charting process effectively creates it's own goal state for later creating a pulumi program for each stack with the required information. This program creation is done entirely in python, with a new function that operates like a normal pulumi automation api program function.
• The process of capturing information for resources created in a pulumi/my framework program for later reconstruction is not necessarily clean. The Resource constructor is monkey patched in the charting process in order to discover properties (i.e. arguments that need to be passed to the resources to create them in a pulumi new program), to find only the arguments and not outputs, the signature of the internal init method is read, which is basically private.
• This has been developed mostly with integration test driven development, with a behavioral focus. All features have been added by writing tests/example programs, running the custom program runner/pulumi together and verifying the results after. This means that while some pieces could be considered dirty and break due to changes in python pulumi code (i.e. framework code relying on private methods that could change), it would be trivial to check compatibility with a pulumi version by running the tests, and reasonable to use the failing tests to guide fixing them. Scenarios for features can be seen here:
https://github.com/RequiemWorld/requiem_omnislash/blob/935be99325abcab916e5f70d3edde8c7dfae1542/tests/test_program_runner_resources.py , and here
https://github.com/RequiemWorld/requiem_omnislash/blob/935be99325abcab916e5f70d3edde8c7dfae1542/tests/test_program_runner_relationships.py .
• Most importantly, the goal is that writing infrastructure as code does not change. No complicated code using the automation API and using multiple stacks will have be written when writing infrastructure code. The automation API is advertised as being capable of something to use for scripting up blue/green deployment patterns, but it isn't reasonable to exit declarative code for something that a framework could handle more nicely and the edge cases of.
I am dead serious about seeing this through so that the type of deployment shown in the article can be achieved safely. I have put 21 hours of work into designing the start of this/writing the initial code for it. I started on the 13th and I've designed and built it up iteratively, one behavior/test at a time. It doesn't do what the goal is yet but a component system and multiple stack creation is there, along with getting outputs and stuff like that right.
I'm not saying any of this as a complaint or intended to say anything bad about pulumi. I'm sharing this on the contrary, I love what I have experienced with pulumi and I am dead serious about using it, it's the only option I take seriously. I think what I'm experiencing with the automation API speaks volumes to how composable, useful, and capable pulumi really is. I guess I'm posting this here because I'm interested in sharing my effort/getting reactions if anyone should take the time to read this, I would hope that what I think is a serious effort for writing a framework based on pulumi (which I don't see anyone else doing) would seem interesting. If not, that's fine, just wanted to say my piece and share an update since last time 🙂