iac.htora.dev · security templates

Home/Refreshers/Encryption keys you control and can switch off: refresher

Encryption keys you control and can switch off

Your own keys, rotated on a schedule, with a usage log and an off switch.

Remember

  1. Data is written: to storage, a database, a disk.
  2. Encrypted with your key: every use recorded.
  3. The key rotates on schedule: old data stays readable.
  4. Disable the key: and the data cannot be read.
PlatformUsesThe part that catches people
AWSA KMS key with yearly rotation, managers and users kept apart, and an alert on the off switchA key policy that names only a role you later delete leaves a key nobody can manage, and only AWS Support can recover it.
AzureA Key Vault key with a rotation policy, Azure roles for access, and an audit logOwner on a subscription can create a vault and still cannot create a key inside it.
Google CloudA Cloud KMS key with 90-day rotation, roles kept apart, and every use loggedGoogle Cloud switches off key versions, one at a time.
Oracle CloudA Vault key with hardware protection, an off switch in code, and policies keeping roles apartEvery vault has two addresses.

Run the quick start

Download providersterraform init
Previewterraform plan
Applyterraform apply
Print the proof commandsterraform output verify

Watch out

  • Rotation changes the key material used for new encryption.
  • Services that use envelope encryption keep a data key in memory for a while, so switching a key off may take effect only when they next ask the key service.
  • A completed key deletion is permanent.
Check it worked

Encrypt something, switch the key off, and try to decrypt it. The decrypt must fail.

Read the full pageDownload PDF

Registry 0.23.0. Built 2026-11-17.

Made by Habibullah Tora. Source on GitHub. Code under the MIT licence, writing under CC BY 4.0.