Secrets Rotation - Automate or Get Breached
A secret gets rotated by hand, someone forgets a downstream service still holds the old value, and production falls over. This is one of the most common compliance and reliability questions in DevOps and SRE interviews because it exposes whether a candidate treats secrets as a config detail or as a production dependency that needs the same rigor as any other deploy.
The answer interviewers want
Manual secrets rotation is a recipe for disaster. At any real scale, it needs to be automated, with a gradual rollout rather than a flip-the-switch cutover.
Use a dedicated secrets management system, something like Vault, AWS Secrets Manager, or Azure Key Vault, and drive the rotation through infrastructure-as-code with terraform so the process is versioned, repeatable, and auditable instead of a manual runbook step.
Two practices matter most once the tooling is in place:
- Always test rotation in staging first. Don't let a new rotation path touch production before you've watched it succeed somewhere lower-stakes.
- Keep old secrets valid during the transition period. Rotation isn't an instant swap. Services that haven't picked up the new secret yet, due to caching, slow restarts, or deploy lag, need the old one to still work until everything has cut over cleanly.
Put together: automated rotation, staged rollout, infrastructure-as-code to manage the process, staging validation first, and an overlap window where both old and new secrets are accepted.
Why interviewers ask this
They're checking whether you understand secrets as a distributed systems problem, not just a security checkbox. Anyone can say "use Vault." The signal they actually want is whether you think about overlap windows, staged rollout, and testing before production, because that's where real outages happen.
Follow-ups to expect
What happens if a service doesn't support dual secrets during the overlap window? That's the riskiest case, since without a valid-old-and-new window, rotation becomes a hard cutover and any lag in picking up the new secret causes an outage; this is exactly why the transition period approach matters.
Why use Terraform for secrets rotation instead of a manual process or a script? Because it makes rotation infrastructure-as-code: versioned, reviewable, and repeatable, instead of a one-off manual action that's easy to get wrong or forget to document.
Why test in staging first instead of just rotating in production with monitoring in place? Because rotation can break in ways that are hard to catch from monitoring alone, like a service silently holding a cached credential, and staging gives you a safe place to surface that before it hits production.
The common wrong answer
Most candidates jump straight to naming a tool, Vault or Secrets Manager, and stop there, as if picking the product is the whole answer. That misses the actual operational discipline: automation plus gradual rollout, staging validation, and keeping old secrets valid during the cutover. A tool name without that process is exactly the setup that breaks production the first time rotation runs for real.
Prefer it spoken? Watch the 30-second answer on YouTube