thousands-window-76079
04/11/2024, 9:56 AMgreen_bucket for green builds and main_bucket 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 (/dist/app-green/...) into the green_bucket
◦ When I run BLUE_GREEN_CONTEXT=blue pulumi up I want the files from /dist/app/.. to go into the main_bucket
Now the problem is that because pulumi is essentially using GitOps here, the BLUE_GREEN_CONTEXT=blue 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
if greenBuild
s3.Object(green)
elsse
s3.Oject(blue)
I don;'t see any way of solving this using pulumi s3.objects, and i am leaning towards just using aws cli to deploylively-crayon-44649
04/11/2024, 10:22 AM@pulumi/command to wrap it, though with this being a resource you might still have issues.
• Use two different Pulumi stacks (e.g. blue and green). Then in Pulumi.blue.yaml you could configure the bucket name as main_bucket and in Pulumi.green.yaml the green_bucket. 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.thousands-window-76079
04/11/2024, 10:26 AMthousands-window-76079
04/11/2024, 10:27 AMpulumi/command I will look into thatlively-crayon-44649
04/11/2024, 10:29 AMcommand or using automation to run non-Pulumi code), that would be my approach.thousands-window-76079
04/11/2024, 10:30 AMlively-crayon-44649
04/11/2024, 10:32 AMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by