Terraform interview question
What happens if the CI runner crashes or loses connectivity during terraform apply?
Scenario Asked in DevOps Engineer · Cloud Engineer · Site Reliability Engineer (SRE) interviews
Summary
The in-progress API call either completes or fails on the AWS side — Terraform has no way to cancel it. The state lock remains held until it expires or you force-unlock it. The state file may or may not reflect the last completed resource, depending on when the crash occurred.
Keep reading with a membership
The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.
More Terraform questions
- When do you need depends_on in Terraform, and when is it a code smell?
- Someone manually deletes an EC2 instance that Terraform manages. What happens on the next plan and apply?
- How do you configure OIDC authentication between GitHub Actions and AWS for Terraform pipelines?
- How do you use Terraform to deploy the same infrastructure to nonprod and production AWS accounts?
- What are the main terraform state subcommands, and when do you use them?
- Terraform apply fails halfway through — some resources were created, others were not. How do you recover?
- How should nonprod and production Terraform configurations differ, and how do you enforce those differences?
- What is Terraform, and how does it work at a high level?