I'm wondering if there a pulumi native solution to...
# general
I'm wondering if there a pulumi native solution to the following problem: • I have blue/green deployment set up using s3 buckets for a static website
for green builds and
for the live app • I have provisioned appropriate long-lived infra for this, Lambda@Edge, certs etc. • Now I want the following behaviour ◦ When i run
pulumi up
it assumes a green build, and places my app files (
) into the
◦ When I run
BLUE_GREEN_CONTEXT=blue pulumi up
I want the files from
to go into the
Now the problem is that because pulumi is essentially using GitOps here, the
will conditionally cause S3 objects to be deleted . e.g when I run
pulumi up
any conditional logic I ahve in my pulumi file to put the content into the green bucket, will now cause the blue bucket to be delete
Copy code
if greenBuild
I don;'t see any way of solving this using pulumi s3.objects, and i am leaning towards just using aws cli to deploy
Hey @thousands-window-76079. I think your assessment is correct, yes. There are a few options that I can see though: • Use the AWS CLI as you suggest. You could use
to wrap it, though with this being a resource you might still have issues. • Use two different Pulumi stacks (e.g.
). Then in
you could configure the bucket name as
and in
. Then rather than bringing up one stack with conditional elements, you are bringing up the same stack with two different configurations. • Use Pulumi Automation to run the "unconditional" bit of the stack (bring up the buckets, link everything together etc.) then use the AWS SDK in your language of choice to do "the last bit" of actually pushing the relevant objects to the right place.
hi @lively-crayon-44649 thanks for your reply! I like your second point actually, but my issue is that I don't want a second CF distribution, etc. for each stack - so i would have to split up the pulumi project into "base blue green infra" and then the actual "app code" project but thats definetly something to think about, because i may end up having other apps that need to share this kind of infrastructure anyway
I also wasn't aware of
I will look into that
It really depends how complicated you want to make it, but I think some sort of separation could be beneficial. Whether that's an "environment" stack (unconditional things, CF distribution, etc.) and the "application" stack(s) -- blue and green, or just separating the single program into two bits (one of which is more
or using automation to run non-Pulumi code), that would be my approach.
yeah i want it to be super simple, i think i will go with the command based approach for the S3 deployment Thanks for your help!
👍 No worries!