How would you run drift detection across 80 workspaces?
AdvancedScenarioImport Refactoring Drift and Lifecycle
Answer
Situation read → One-off checks don't scale.
What I'd do →
- In HCP Terraform, enable health assessments (drift detection) on workspaces; or in CI run a nightly matrix of
plan -detailed-exitcode -refresh-onlywith a read-only role. - Aggregate results: Slack alerts for drift, tickets with an owner by workspace tag.
- Track a drift metric over time.
- Decide a policy: auto-revert for non-prod, ticket for prod.
Why → The goal is mean time to detect drift, not just detection.
Interview tip → Say who acts on the alert.
More on Import Refactoring Drift and Lifecycle
An S3 bucket was created by hand in the console and now must be managed by Terraform. How do you bring it in?BeginnerYou must adopt 200 existing resources and don't want to write all the HCL by hand.IntermediateHow do you find out that someone changed infrastructure outside Terraform?BeginnerSomeone opened port 22 on a security group in the console. Terraform wants to remove it. What's your process?IntermediateAn Auto Scaling group's desired capacity is changed by autoscaling, and Terraform keeps resetting it.IntermediateHow do you protect a production database from an accidental `terraform destroy`?Beginner