Real
DevOps
Interview
Questions
Companies
Mock Interview
Study Guide
Tools & Tech
Search questions, tools...
⌘K
Questions
Companies
Mock
Guide
Tools
Home
/
Terraform
/
Interview Questions
/
Advanced
📝
Terraform Advanced Interview Questions
Beginner
Intermediate
Advanced
Architect
32 Terraform advanced questions with detailed answers, HCL examples, and interview tips.
≣
List
⚡
Flashcard
All (32)
state (10)
backends (1)
modules (4)
general (7)
providers (1)
workspaces (1)
variables (1)
Terraform (7)
Asked by:
All Companies
Capital One
Coinbase
Datadog
Goldman Sachs
HashiCorp
JPMorgan
Shopify
Stripe
Value Momentum
0/32 reviewed
01
How does Terraform remote state locking protect production infrastructure, and what failure modes appear when teams split state incorrectly?
advanced
state
Stripe
Capital One
HashiCorp
02
How do you handle Terraform state locking and what happens during lock conflicts?
advanced
backends
Stripe
Capital One
HashiCorp
03
How do you structure Terraform for a multi-account AWS organization?
advanced
modules
Capital One
Value Momentum
Coinbase
04
What are Terraform moved blocks and how do you refactor without destroying resources?
advanced
state
05
How does terraform plan detect drift and what are its limitations?
advanced
general
Stripe
Shopify
HashiCorp
06
How do you implement a Terraform CI/CD pipeline with plan approval workflow?
advanced
general
Stripe
Shopify
HashiCorp
07
What are Terraform providers behind the scenes — gRPC plugin protocol?
advanced
providers
08
How do you test Terraform code (terratest, terraform test, plan assertions)?
advanced
general
09
How do you handle Terraform state corruption and recovery?
advanced
state
Stripe
Capital One
HashiCorp
10
How do Terraform import blocks reduce risk vs ad hoc terraform import commands during production adoption?
advanced
state
11
How do you deploy EKS clusters using Terraform, and what module structure do you use for the cluster, node groups, and networking?
advanced
modules
Value Momentum
Coinbase
Capital One
Datadog
12
How do you structure AWS accounts for Dev, QA, UAT, and Prod environments in Terraform — single account or multi-account with AWS Organizations?
advanced
workspaces
Value Momentum
Capital One
Coinbase
13
How do you manage Terraform state files securely — where do you store them, what S3 bucket structure do you use for multiple environments, and how do you prevent state corruption?
advanced
state
Value Momentum
Stripe
Capital One
HashiCorp
14
How do you prevent one Terraform environment from accidentally affecting another when using shared modules and remote state?
advanced
state
Value Momentum
Stripe
Capital One
HashiCorp
Coinbase
Datadog
15
How do you implement Terraform CI/CD pipelines — what approval gates and plan/apply workflows do you use for production changes?
advanced
general
Value Momentum
Stripe
Shopify
HashiCorp
16
How do you handle Terraform state drift when someone makes manual changes in the AWS console, and how do you detect and remediate it?
advanced
state
Value Momentum
Stripe
Capital One
HashiCorp
Shopify
17
How do you design Ansible and Terraform to work together — what does each tool handle best?
advanced
general
18
How do you implement Sentinel policies in Terraform Enterprise to enforce compliance in a regulated bank?
advanced
general
Capital One
JPMorgan
Goldman Sachs
19
How do you manage infrastructure drift detection at enterprise scale with scheduled plan runs?
advanced
state
Stripe
Shopify
HashiCorp
20
How do you design Terraform module governance with a private registry, versioning, and team ownership?
advanced
modules
Coinbase
Capital One
Datadog
21
How do you manage Terraform state securely in a multi-team environment?
advanced
state
22
When would you use for_each instead of count in Terraform, and what breaks when you choose wrong?
advanced
variables
23
How do you move existing resources into a Terraform module without recreating them?
advanced
modules
24
How do you detect and manage infrastructure drift in Terraform?
advanced
state
25
How do you enforce security and compliance checks before running terraform apply?
advanced
general
26
How do you handle Terraform state file corruption in production? Describe your recovery process and how you prevent it from happening.
advanced
Terraform
27
You run terraform plan and see 47 resources being destroyed and recreated that should only be updated in-place. What happened and how do you fix it?
advanced
Terraform
28
Compare OpenTofu and Terraform post-BSL license change. What are the technical differences, migration considerations, and how do you advise an organization currently using Terraform Cloud?
advanced
Terraform
29
Describe Terraform's 'terraform test' framework. How does it differ from Terratest, and how would you implement a comprehensive testing strategy for a Terraform module that provisions a VPC with public/private subnets?
advanced
Terraform
30
You need to recover from a corrupted Terraform state file where the state shows resources that no longer exist in AWS, and AWS has resources not tracked in state. Walk through the state surgery process.
advanced
Terraform
31
Compare Sentinel and OPA (Open Policy Agent) for Terraform policy enforcement. How would you implement a policy that prevents any S3 bucket from being created without encryption, versioning, and a lifecycle policy?
advanced
Terraform
32
Your team accidentally ran 'terraform destroy' on a production environment. The state file shows all resources as destroyed, but the S3 backend has versioning enabled. Walk through the complete recovery process including state restoration and resource reconciliation.
advanced
Terraform
✦
Feedback / Comment