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

calm-queen-58154

06/14/2023, 4:53 PM
How do you go about having pieces that need to be created before others. Specifically creating an ECR repository, have a GitHub action workflow push a first image that depends on the creation of the repository which can then be deployed in apprunner for example.
f

fresh-scientist-56300

06/14/2023, 5:05 PM
There's an inherent dependency analysis that Pulumi does by default. The key to thinking about this is that your entire code will run before any resources are modified/created/destroyed. It's basically making a list of instructions to do on your resources. If you run a function that depends a previously configured resource, it knows to put that further down the list. That said, if there's a very specific order you need things to run it, you can use the Depends On function: https://www.pulumi.com/docs/concepts/options/dependson/ This can override the automatic inference, which can cause problems, so use with care.
c

calm-queen-58154

06/14/2023, 5:22 PM
I’ll have a look. Thé Major issue I can think off the async nature of this. Create repo Wait or pause so another process somewhere builds and pushes the image Continue. Of course I could create the repository by hand, but that kind of defeats the purpose of using pulumi
f

fresh-scientist-56300

06/14/2023, 5:28 PM
So this is what I'm running into myself right now... And what I'm doing is embracing the "microstacks". Again, you have to think about that the resources aren't created or modified until the whole script has been completed. Look into Stack Outputs to understand more on that. https://www.pulumi.com/learn/building-with-pulumi/stack-outputs/ https://www.pulumi.com/docs/concepts/inputs-outputs/
So for example, I'm building a microstack in one subdirectory that will hold AWS account creation. Another microstack handles GitHub and uses the outputs from the first microstack to create a repository for that AWS account in GitHub.
This is where I'm at as I adopt Pulumi, so there could be some other elements I'm missing, but hopefully that speeds you up to where I'm at.
c

calm-queen-58154

06/14/2023, 6:07 PM
That makes sense, I made a core project and another that depends on it but taking it further is worth looking. Thanks for the feedback!
2 Views