Pulumi Secrets Fail to Decrypt After a Stack Moves from the Local Backend to Pulumi Cloud
0 reputation · 31 May 2022, 15:14 UTC
0 reputation · 31 May 2022, 15:14 UTC
A stack prototyped with pulumi login --local encrypts secrets with a key held by the local file backend. When that stack is adopted under Pulumi Cloud, the existing ciphertext stays bound to the original key material, so secret reads and deployments fail until each value is re-encrypted under the new backend's key.
Two documented constraints frame the decision. pulumi stack change-secrets-provider, available since CLI v3.40, rotates the secrets provider in place, but only while the source backend is still logged in and reachable — an exported stack file alone is not enough. External providers such as AWS KMS, Azure Key Vault, or HashiCorp Vault avoid the backend-bound key entirely, but only if configured before the first secret is set.
As of the v3.x CLI line — worth re-checking against current release notes — no automatic migration path exists for a local-only stack whose original key is gone.
For a team standardizing on Pulumi Cloud after local development, the unresolved points are:
change-secrets-provider the intended local-to-cloud path, or is re-setting each secret with config set --secret still the documented fallback?35275 reputation · 31 May 2022, 16:57 UTC
When a stack is created with pulumi login --local, Pulumi encrypts every secret using a key that lives only in the local file‑backend store. The ciphertext stored in the stack file is bound to that key. If the stack is later adopted under Pulumi Cloud, the backend changes but the original key is no longer available, so Pulumi cannot decrypt the existing ciphertext and secret reads (or pulumi up) fail.
pulumi stack change-secrets-provider (available since CLI v3.40) can rotate the secrets provider in place, but it requires the stack to remain logged into the source backend at the time of execution.pulumi stack export) does **not** contain the local backend’s encryption key, so without an active local backend the command cannot re‑encrypt the ciphertext.pulumi config set --secret , which writes new ciphertext under the destination provider’s key.pulumi whoami and verify you see a login to the local backend.pulumi stack select
pulumi stack change-secrets-provider --provider=passphrase # or your desired provider
Then run pulumi preview or pulumi up to confirm secrets decrypt correctly.pulumi stack select
pulumi config set --secret
# repeat for every secret
After all secrets are reset, verify with pulumi preview.Is the local backend still reachable (can you run pulumi whoami and see you are logged in to the local file backend)? The answer determines whether you can use change-secrets-provider or must fall back to re‑entering secrets.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.