I'm trying to "glue" together Pulumi (or any infra...
# general
b
I'm trying to "glue" together Pulumi (or any infra-as-code) code and application code. Traditionally if you have an app that needs an S3 bucket (or any other cloud resource) to store things, you would create that S3 bucket in Pulumi, and then pass the bucket's information to your app during the deployment (at least that's how most Terraform project I've worked on do things). The issue I have with this is that your Pulumi project, in a sense, has business logic that should be in the app itself. If my app now needs the S3 bucket to be public, I have to edit seperate Pulumi code. Any cleaner way to do this or am I trying to be too DRY?
b
Sounds like automation api is going to be your friend here
๐ŸŽฏ 1
b
Seems like a huge shift, I'm very excited/interested about it! Cheers ๐Ÿ˜„
g
@brave-planet-10645 If the automation API was used to reconfigure an S3 bucket to be public, wouldn't the pulumi project code (that originally defined the S3 bucket) be out of date?
b
@green-musician-49057 so your automation api program is a replacement for your "standard" pulumi program. You can tell it to run a "standard" pulumi program (here's a good example of that) or you can just run your code as is (here's an example of that)
One thing to note is that you do need to have the Pulumi CLI on your machine / CI / container, but you're not running it yourself
g
Got it -- so in Pier-Luc's example, the entire definition of that S3 bucket would be in their application code, using the automation API.
b
correct
๐Ÿ‘ 2
<plug> You can sign up to our Pulumi UP event (free!) and there's going to be some demos with this: https://www.pulumi.com/pulumi-up/
b
Wouldn't miss it ๐Ÿ˜„
๐ŸŽ‰ 2
Also whoever came up with the aesthetics/design of that page is awesome
b
I'm really into lofi-type music at the moment (I find I can just have it on all day at work and it helps me concentrate) so I really liked it
โค๏ธ 1
b
One part I don't quite see how I'll do using this is subscribe to an SNS topic. If I do it using the automation API, my application would have to know that it is deployed before subscribing to the topic (because if it subscribes before being "live" (either from blue/green dpeloyments or even simple K8S rolling updates), SNS might send messages before the application can receive them
(Also Zelda&Chill album ๐Ÿ‘Œ)
o
we built an abstraction model to do this. We have a pulumi program that builds about 15-20 different AWS API objects (dynamo, S3, SQS, SNS, etc etc). We defined a config schema and our developers include a yaml file in their repo that defines all the AWS infra they want for their app. It has its own pipeline so when they PR this yaml file, a pipeline runs that checks for or creates a new stack of that centralized pulumi program that runs just for their app and creates infra in each environment.
๐Ÿ˜ƒ 1
at least in our use-case, we werenโ€™t/canโ€™t going to have 400 developers writing pulumi code and due to security and other best-practice type concerns, we decided just presenting config was the best approach for us
b
Yeah I can definitely see that working. Thanks for your input ๐Ÿ˜„
๐Ÿ‘ 1
o
in some regards we re-implemented what the automation API is doing but in bash