Pulumi Error: 'the stack's secrets provider does not match' the Configured One
Fix Pulumi's 'secrets provider does not match' error: reconcile Pulumi.<stack>.yaml with the provider recorded in state using pulumi stack change-secrets-provider so secrets decrypt again.
- #pulumi
- #iac
- #troubleshooting
- #errors
Stuck on this Pulumi error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Exact Error Message
error: getting secrets manager: the stack's secrets provider does not match
the specified provider: the stack "prod" was created with secrets provider
"awskms://alias/pulumi-old?region=us-east-1" but the configured secrets
provider is "awskms://alias/pulumi-new?region=us-east-1"
error: constructing secrets manager: secrets provider mismatch
The passphrase-vs-cloud variant reads:
error: the stack's secrets provider does not match the specified provider:
expected "passphrase" but got "awskms://..."
What It Means
A Pulumi stack records the secrets provider that encrypted its secrets in two places: the secretsprovider (and encryptedkey/encryptionsalt) fields in Pulumi.<stack>.yaml, and the secrets_providers block inside the stack’s state/checkpoint. On every operation Pulumi checks that these agree before it tries to decrypt anything.
This error means the two no longer match — for example, the config file was edited to point at a new KMS key or switched from passphrase to KMS, but the state still expects the original provider. Pulumi refuses to guess, because using the wrong provider would fail to decrypt existing secrets (or silently mis-handle them). It is a consistency guard, not a broken key.
Common Causes
- Someone hand-edited
secretsproviderinPulumi.<stack>.yamlinstead of usingpulumi stack change-secrets-provider. - The stack was migrated between backends and the config file’s provider URL was updated but state was not re-encrypted.
- A
Pulumi.<stack>.yamlfrom a different stack/environment was copied over. - Switching a stack from the default
passphraseprovider to KMS (or vice versa) without the migration command. - A KMS alias was re-pointed to a new key, changing the effective provider URL.
Diagnostic Commands
See the provider the state expects:
pulumi stack export | jq '.deployment.secrets_providers'
See the provider the config file specifies:
grep -A2 secretsprovider Pulumi.prod.yaml
Confirm which stack you are actually operating on:
pulumi stack ls
Check that your identity can reach both the old and new KMS keys if migrating:
aws kms describe-key --key-id alias/pulumi-old --region us-east-1
aws kms describe-key --key-id alias/pulumi-new --region us-east-1
Step-by-Step Resolution
- Decide the source of truth. If the config file was edited by mistake, revert it to the provider recorded in state:
git checkout -- Pulumi.prod.yaml
pulumi preview --stack prod
- If you genuinely intend to move to a new provider, use the migration command — this re-encrypts all secrets and updates both config and state atomically. The old provider must still be reachable so Pulumi can decrypt first:
pulumi stack change-secrets-provider "awskms://alias/pulumi-new?region=us-east-1" --stack prod
- To move to the passphrase provider instead, pass the literal
passphraseand set the new passphrase:
export PULUMI_CONFIG_PASSPHRASE='new-strong-passphrase'
pulumi stack change-secrets-provider passphrase --stack prod
-
If the config file was copied from another environment, restore the correct file for this stack rather than migrating.
-
Verify config now decrypts cleanly under the reconciled provider:
pulumi config --stack prod --show-secrets
- Re-run the original command:
pulumi up --stack prod
Prevention
- Never edit
secretsprovider,encryptedkey, orencryptionsaltby hand — always usepulumi stack change-secrets-provider. - Keep the old provider/key available until the migration completes; the command must decrypt with the old key before re-encrypting.
- Use per-stack config files and avoid copying
Pulumi.<stack>.yamlbetween environments. - Point KMS aliases at stable keys, and migrate deliberately rather than re-aliasing under a running stack.
- Commit the migration in its own change so reviewers can see the provider transition.
Related Errors
could not decrypt configuration value— the provider matches but the key/passphrase is wrong.passphrase must be set with PULUMI_CONFIG_PASSPHRASE— the passphrase provider with no passphrase supplied.AccessDeniedExceptionfrom KMS — an IAM issue reaching the key during migration.getting secrets managerfailures generally — the umbrella category this mismatch falls under.
Frequently Asked Questions
How do I switch secrets providers the correct way? Run pulumi stack change-secrets-provider <new-provider>. It decrypts every secret with the current provider and re-encrypts under the new one, updating both the config file and state so they stay in sync.
Why not just edit Pulumi.<stack>.yaml to the new provider? Because the state still records the old provider and the secrets are still encrypted with the old key. Editing only the config file produces exactly this mismatch error.
Do I need access to the old key during migration? Yes. Pulumi must decrypt existing secrets with the old provider before re-encrypting, so both old and new keys (or the old passphrase) must be available at migration time.
Can this happen from a bad merge? Yes — a merge that pulls in another environment’s Pulumi.<stack>.yaml will change the provider URL. Restore the correct file for the stack instead of migrating. Reusable secrets-migration checklists are in the prompt library.
Where can I read related fixes? Browse the full Pulumi guides for more secrets and state troubleshooting.
Fixed it? Get 500 Pulumi & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.