HomeInterview QuestionsTell one scenario where you used Terraform lifecyc…

Tell one scenario where you used Terraform lifecycle in infrastructure automation.

🟡 Medium Behavioral Mid level
1Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

In a recent project, we needed to upgrade a critical database cluster without downtime. The database resource in Terraform had a lifecycle rule that prevented deletion: prevent_destroy = true. This ensured that Terraform would not accidentally delete the database during a plan that removed or renamed the resource. Additionally, we used create_before_destroy to create a new database instance before destroying the old one, guaranteeing that the new instance was fully provisioned and healthy before the old one was removed. This lifecycle configuration allowed us to perform a rolling upgrade: Terraform created the new instance, ran health checks, and only after confirmation did it delete the old instance. The result was zero downtime and a safe, automated migration path that could be version‑controlled and reviewed in code.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500