sparse-intern-71089
03/02/2023, 9:17 PMlittle-cartoon-10569
03/02/2023, 9:25 PMpulumi login <backend>
before pulumi stack select
.little-cartoon-10569
03/02/2023, 9:26 PMbillowy-army-68599
elegant-dog-76355
03/02/2023, 9:30 PMechoing-dinner-19531
03/02/2023, 9:32 PMwe don’t yet support per stack backendsJust to set expectations, I don't think we'll ever support this. The backend tells us the stack, its very flipped logic to somehow get a stack to tell us what backend to use.
little-cartoon-10569
03/02/2023, 9:36 PMelegant-dog-76355
03/02/2023, 9:44 PMdev
and another for staging
etc. I have been deploying to aws for a while now with diffrent customers and it has always been the case that each of these environments (`dev`|`stage`|`prod`) are in diffrent aws accounts. Coming from a terraform/cloudformation background this pretty standard setup.
Your comment "The backend tells us the stack" now makes sense why this would not be supported. I just need to get my head around a bit more on how pulumi works 🙂
very happy to go ahead and try out @little-cartoon-10569 suggestionbillowy-army-68599
elegant-dog-76355
03/02/2023, 9:59 PMdev_backend.config
which contains the following:
bucket = "terraform-backend-eks-hello-dev"
region = "eu-west-1"
key = "terraform-backend-eks-hello-dev/eu-west-1/dev/terraform.tfstate"
dynamodb_table = "dynamo-terraform-state-lock"
encrypt = true
then in github actions you pass this file into terraform to initialise the setup
- name: Terraform Init
run: |
terraform init -input=false -backend=true -backend-config="backend.config"
shell: bash
working-directory: ${{ env.TF_EKS_ENTRY_POINT }}
you can then have a backend end file for called prod_backend.config
and so on. Terragrunt is a great tool for keeping your code DRY but you don't need it to support multiple backends.
again thanks for all the advise on this. Only first week with Pulumi so I have allot to learnbillowy-army-68599
terraform init
phase is analogous to pulumi login
little-cartoon-10569
03/02/2023, 10:06 PMlittle-cartoon-10569
03/02/2023, 10:06 PMbitter-carpenter-93554
03/04/2023, 1:36 AMbackend:
url: s3://${AWS_BUCKET}?region=us-east-1
bitter-carpenter-93554
03/04/2023, 1:46 AMexport PULUMI_BACKEND_URL="<s3://your-bucket?region=us-east-1>"
elegant-dog-76355
03/04/2023, 8:39 AMpulumi login
cmd because if that fails you can catch and react to the error but thats just my option 1 week in using pulumi :-)