A plan scheduled deletion of the network-token CMK that live card payments still unwrap
The scenario
A Terraform plan in the card-token AWS account wants to schedule deletion of the KMS key that unwraps network tokens. Those tokens stand in for card numbers under the card-on-file rules. Live checkout still unwraps this key on every saved-card payment. The plan has not applied yet. Someone wants it applied tonight because a newer key alias exists in the same account.
Model answer
What I'd say first:
I would not apply that plan. Deleting the key that unwraps network tokens stops saved-card payments, and it does not make the card data safer tonight.
How I'd work it:
- 1Block apply in the token account. Make sure a scheduled deletion is not already pending on the key. Cancel it if someone started it.
- 2Confirm live payments still call this key, and that the new alias points at a different key that has not wrapped the existing tokens. A second alias is not proof the tokens were re-wrapped.
- 3Keep the current key enabled. Schedule a re-wrap to the new key as its own change, with a rollback that still has the old key. Do it outside the sale window, with two people on the apply.
- 4Tell the room we are protecting checkout, not delaying hygiene. Saved cards keep working. Raw card numbers stay in the vault either way.
How I'd explain it:
A network token is useless if we cannot unwrap it at pay time. KMS deletion has a waiting period, then the ciphertext is gone. A wrong answer is to schedule deletion because a new alias exists, or because two keys feel messy.
How I'd prevent it:
Destroy and schedule-delete on this key should require two approvers in the API path, not a wiki note. Terraform plan in this account should fail if it includes ScheduleKeyDeletion while the key is still referenced by the vault. Re-wrap is a measured migration with a proof that a sample of tokens unwrap under the new key before the old one can be retired.
The follow-up they'll ask
“The new alias is already there. Schedule the old key deletion tonight so we do not leave two keys?”
No. I would not schedule deletion tonight because a new alias exists. The alias may not hold the wrapped tokens. If we delete the key that live checkout unwraps, saved cards fail and we cannot get the plaintext back. I cancel any pending deletion, keep the old key, and re-wrap later with the old key still alive.
Common mistakes
- Scheduling CMK deletion on a plan
- Assuming the alias is a copy of the key
- One person applying in the token account
- Re-wrapping during a sale