https://pulumi.com logo
#general
Title
# general
b

busy-toothbrush-90194

11/07/2023, 12:05 PM
Hi Folks, I am trying to initialize a stack using
pulumi stack init --secrets-provider="<awskms://alias/kms?region=us-west-2>" --stack org-name/stack-name
but getting
error: organization name must be 'organization'
can anyone explain what's causing this error?
f

fierce-night-38522

11/07/2023, 12:28 PM
Hi @busy-toothbrush-90194 ! I have not seen this error before, but I will see if I can help you get it resolved. Would you mind sharing which version of Pulumi you're on? Also as a quick sanity check, if you run the command without the
--secrets-provider
flag, does it still give the same error?
b

busy-toothbrush-90194

11/07/2023, 1:37 PM
Let me try
my pulumi version is
v3.82.0
I am trying this with aws s3 backend
f

fierce-night-38522

11/07/2023, 1:40 PM
The current version is
v3.92.0
. I would recommend updating Pulumi in your environment to start and try again. If you still get the same error, then we'd probably have to look into your S3 backend configuration I'm thinking
b

busy-toothbrush-90194

11/07/2023, 1:43 PM
Do I need to specify the default org when I do pulumi login s3://<backend-name>
Copy code
--default-org string   A default org to associate with the login. Please note, currently, only the managed and self-hosted backends support organizations
p

proud-pizza-80589

11/07/2023, 1:44 PM
anything that is not cloud has this. instead of <orgname>/<project>/<stackname> use organization/<project>/<stackname>
b

busy-toothbrush-90194

11/07/2023, 1:44 PM
AWS s3 falls in the self hosted backend category I assume.
So we can't set the organization to any values other than
organization
with non pulumi cloud backend?
p

proud-pizza-80589

11/07/2023, 1:48 PM
i think so
b

busy-toothbrush-90194

11/07/2023, 1:51 PM
Okay, in my case this changes the name of the stack with pulumi cloud it is
org-name/stack-name
but with s3 it is just the
stack-name
. In s3 realm org name won't be as relevant as in Pulumi cloud but it would have been nice to keep the stack name the same post migration.
Anyways thanks for the help Roderik & Torian.
p

proud-pizza-80589

11/07/2023, 1:54 PM
in case this helps, this is my migration script • migrates stacks with staging- in the name • fixes a stack reference that also moved to s3 • does not break the original cloud stack in case i mess up
Copy code
#!/bin/bash -x

export PULUMI_ACCESS_TOKEN="pul-xxx"
export PULUMI_CONFIG_PASSPHRASE=xxx

rm -Rf Pulumi.yaml Pulumi.*.yaml
echo "name: bpaas" > Pulumi.yaml
echo "runtime: nodejs" >> Pulumi.yaml
pulumi logout
pulumi login
STACKS=$(pulumi stack ls -j | jq -r ".[].name" | sed "s/settlemint\///" | grep 'staging-')
while read -r stack; do
  echo "Migrating stack ${stack}"
  pulumi logout
  pulumi login
  pulumi stack select settlemint/bpaas/${stack}
  pulumi stack change-secrets-provider "<awskms://alias/xxx-xxx-xxx?region=eu-central-1>"
  pulumi stack export --show-secrets --file ${stack}.json
  pulumi stack change-secrets-provider default
  pulumi logout
  pulumi login '<s3://xxx-xxx-xxx?region=eu-central-1>'
  pulumi stack init ${stack} || pulumi stack select organization/bpaas/${stack}
  cat ${stack}.json | sed 's/settlemint\/bpaas-clusters/organization\/bpaas-clusters/g' > ${stack}-replaced.json
  pulumi stack import --file ${stack}-replaced.json
  pulumi refresh --yes
done <<< "$STACKS"
b

busy-toothbrush-90194

11/07/2023, 2:46 PM
Thanks a lot for sharing this, I am doing something similar.
We are facing issues with cross-stack reference when one stack is moved but other is not? Did you also have this issue by any chance? if so how did you approach this?
p

proud-pizza-80589

11/07/2023, 2:51 PM
i moved the base stacks first, but left them on cloud too (k8s clusters where i only use the kubeconfig from) and then i move the using stacks
3 Views