wooden-apple-45732
07/08/2024, 10:30 PMPulumi.yaml
I want the backend s3 bucket to be different for each environment.
How do I do it?
Initially I wanted to use the same bucket name in each environment but then remembered that bucket names are global.
name: pulumi_backend
stackConfigDir: ./config
runtime:
name: python
description: S3 backend for self-hosted Pulumi
backend:
url: <s3://fd-pulumi-backend>
basically this needs to be different for each stack (qa
, prod
, etc.):
backend:
url: <s3://fd-pulumi-backend>
clever-sunset-76585
07/08/2024, 10:47 PMPulumi.yaml
). Instead, simply do a pulumi login s3://<bucket>
and then run pulumi stack init <stack name>
. This way, each stack is initialized in a different bucket.little-cartoon-10569
07/08/2024, 10:56 PMclever-sunset-76585
07/08/2024, 10:57 PMlittle-cartoon-10569
07/08/2024, 10:59 PMclever-sunset-76585
07/08/2024, 11:05 PMwooden-apple-45732
07/08/2024, 11:11 PMpulumi login
every time I need access to a specific backend...little-cartoon-10569
07/08/2024, 11:12 PMclever-sunset-76585
07/08/2024, 11:12 PMwooden-apple-45732
07/08/2024, 11:13 PMwooden-apple-45732
07/08/2024, 11:13 PMwooden-apple-45732
07/08/2024, 11:14 PMlogin
clever-sunset-76585
07/08/2024, 11:14 PMpulumi login
is not up to your liking for switching between stacks (which can be annoying) you should do what @little-cartoon-10569 is suggesting.clever-sunset-76585
07/08/2024, 11:14 PMpulumi login
is global.clever-sunset-76585
07/08/2024, 11:15 PMwooden-apple-45732
07/08/2024, 11:15 PMwooden-apple-45732
07/08/2024, 11:16 PMpulumi login
... receipe for a disasterlittle-cartoon-10569
07/08/2024, 11:16 PMThe bucket-name value can include multiple folders, such as my-bucket/app/project1. This is useful when storing multiple projects’ state in the same bucket.
wooden-apple-45732
07/08/2024, 11:17 PMlittle-cartoon-10569
07/08/2024, 11:18 PMlittle-cartoon-10569
07/08/2024, 11:19 PMlittle-cartoon-10569
07/08/2024, 11:19 PMlittle-cartoon-10569
07/08/2024, 11:20 PMlittle-cartoon-10569
07/08/2024, 11:20 PMpulumi login
.little-cartoon-10569
07/08/2024, 11:22 PMAhh, I can't use the same bucket for all projects because each project is for a separate AWS accountThis isn't correct. The state does not need to be in the same account, and indeed, I strongly recommend that it is not in the same account.
little-cartoon-10569
07/08/2024, 11:23 PMwooden-apple-45732
07/08/2024, 11:24 PMwooden-apple-45732
07/08/2024, 11:24 PMlittle-cartoon-10569
07/08/2024, 11:24 PMAs of Pulumi CLI v3.33.1, instead of specifying the AWS Profile, add awssdk=v2 along with the region and profile to the query string. The URL should be quoted to escape the shell operator &, and used as follows:
pulumi login 's3://<bucket-name>?region=us-east-1&awssdk=v2&profile=<profile-name>'
clever-sunset-76585
07/08/2024, 11:24 PM