Skip to main content
InterviewHubPRO
Section Overview
Q11

Question 11 of 50

Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)

22%
Terraform & IaC (50 Qs)•Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)

What is Configuration Drift, and how do you detect and remediate it in Terraform?

senior LevelFormsCI/CD & DevOpsSystem Design

In Simple Words: Configuration Drift happens when an engineer makes manual changes in the AWS Console (e.g. editing a security group rule or changing instance size), making real-world infrastructure differ from Terraform code.

  • Detection: Run terraform plan -refresh-only. Terraform queries cloud APIs and reports discrepancies between real infrastructure and state.
  • Remediation: Running terraform apply overwrites unauthorized manual changes and restores desired state.
  • Prevention: Run scheduled nightly drift detection jobs in CI/CD (GitHub Actions / Atlantis).