DriftAgent: Using a Language Model to Turn Terraform Drift into Reviewed Merge Requests

Authors

  • Nitish Mane Philo, Inc., San Francisco, California, USA

DOI:

https://doi.org/10.47941/ijce.4034

Keywords:

Infrastructure as Code, Configuration Drift, Large Language Models, Atlantis, Site Reliability Engineering

Abstract

Purpose: This paper describes the design and operation of DriftAgent, a system that detects configuration drift in Terraform-managed cloud infrastructure and prepares fixes for human review. It also reports what we learned from running the system in production at a streaming television company.

Methodology: The study used a single-site case study design to evaluate a production deployment. DriftAgent runs every weekday morning: it asks an Atlantis server to plan 187 Terraform projects in parallel, parses the plan output, and sends each drifted project, together with its source files, to a large language model in a single request. The model returns HCL changes, including Terraform import blocks for resources that exist in the cloud but not in state; the agent opens a GitLab merge request for human review and posts a daily summary to Slack. Over twelve weeks (56 runs), we measured four outcomes: the fate of each merge request (merged unchanged, merged after edits, or closed), plan sweep time, engineering time per drift event, and inference cost. Merge request outcomes were validated by two engineers who independently rated a random sample of 120 merge requests as acceptable, acceptable with edits, or unacceptable against defined criteria, and inter-rater reliability was measured with Cohen’s kappa. Engineering effort was compared with a pre-deployment timing study of 71 manually handled drift events. Data were analyzed with descriptive statistics (counts, percentages, means, medians, and 95th percentiles), edited or closed proposals were classified by their main failure reason, and the findings were synthesized by triangulating production logs, merge request histories, the independent ratings, and the timing data.

Findings: Across 56 runs the system recorded 372 drift events and opened 351 merge requests. Reviewers merged 73.5% of them without semantic changes and 18.2% after edits, and closed 8.3%. Moving plan execution from a sequential loop to Atlantis reduced the median sweep time from 52.0 to 11.4 minutes. Weekly engineering time spent on drift fell from 9.4 to 2.4 hours, at an inference cost of about US$0.08 per drifted project. The most common reasons for edited or rejected proposals were choosing the wrong kind of remediation and formatting an import identifier incorrectly.

Unique contribution to theory, practice and policy: The study gives evidence that a fixed workflow with one model call, a deterministic plan check, and mandatory human approval is a workable way to use language models in change-controlled infrastructure. For practitioners, it documents specific design choices and failure modes. For organizations writing policy on AI in operations, it supports keeping approval and apply rights with people while assigning analysis and drafting to the model.

Downloads

Download data is not yet available.

Author Biography

Nitish Mane, Philo, Inc., San Francisco, California, USA

Infrastructure Engineering

References

Ahmed, T., Ghosh, S., Bansal, C., Zimmermann, T., Zhang, X., & Rajmohan, S. (2023). Recommending root-cause and mitigation steps for cloud incidents using large language models. In Proceedings of the 45th International Conference on Software Engineering (pp. 1737-1749). IEEE. https://doi.org/10.1109/ICSE48619.2023.00149

Atlantis. (n.d.-a). API endpoints. Retrieved September 24, 2026, from https://www.runatlantis.io/docs/api-endpoints

Atlantis. (n.d.-b). Repo level atlantis.yaml config. Retrieved September 24, 2026, from https://www.runatlantis.io/docs/repo-level-atlantis-yaml

Beetz, F., & Harrer, S. (2022). GitOps: The evolution of DevOps? IEEE Software, 39(4), 70-75. https://doi.org/10.1109/MS.2021.3119106

Beyer, B., Jones, C., Petoff, J., & Murphy, N. R. (Eds.). (2016). Site reliability engineering: How Google runs production systems. O'Reilly Media.

Chen, Y., Shetty, M., Somashekar, G., Ma, M., Simmhan, Y., Mace, J., Bansal, C., Wang, R., & Rajmohan, S. (2025). AIOpsLab: A holistic framework to evaluate AI agents for enabling autonomous clouds. Proceedings of Machine Learning and Systems, 7. https://proceedings.mlsys.org/paper_files/paper/2025/hash/d1f9e4a9f109b6e8b75ed362736f22ec-Abstract-Conference.html

Cohen, J. (1960). A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20(1), 37-46. https://doi.org/10.1177/001316446002000104

Guerriero, M., Garriga, M., Tamburri, D. A., & Palomba, F. (2019). Adoption, support, and challenges of infrastructure-as-code: Insights from industry. In 2019 IEEE International Conference on Software Maintenance and Evolution (pp. 580-589). IEEE. https://doi.org/10.1109/ICSME.2019.00092

Hassan, M. M., Salvador, J., Santu, S. K. K., & Rahman, A. (2024). State reconciliation defects in infrastructure as code. Proceedings of the ACM on Software Engineering, 1(FSE), Article 83, 1865-1888. https://doi.org/10.1145/3660790

HashiCorp. (n.d.-a). Import block reference. Terraform documentation. Retrieved September 24, 2026, from https://developer.hashicorp.com/terraform/language/block/import

HashiCorp. (n.d.-b). Manage resource drift. Terraform tutorials. Retrieved September 24, 2026, from https://developer.hashicorp.com/terraform/tutorials/state/resource-drift

HashiCorp. (2023, June 12). Terraform 1.5 brings config-driven import and checks [Blog post]. https://www.hashicorp.com/en/blog/terraform-1-5-brings-config-driven-import-and-checks

Kon, P. T. J., Liu, J., Qiu, Y., Fan, W., He, T., Lin, L., Zhang, H., Park, O. M., Elengikal, G. S., Kang, Y., Chen, A., Chowdhury, M., Lee, M., & Wang, X. (2024). IaC-Eval: A code generation benchmark for cloud infrastructure-as-code programs. In Advances in Neural Information Processing Systems 37: Datasets and Benchmarks Track. https://proceedings.neurips.cc/paper_files/paper/2024/hash/f26b29298ae8acd94bd7e839688e329b-Abstract-Datasets_and_Benchmarks_Track.html

Landis, J. R., & Koch, G. G. (1977). The measurement of observer agreement for categorical data. Biometrics, 33(1), 159-174. https://doi.org/10.2307/2529310

Morris, K. (2025). Infrastructure as code: Designing and delivering dynamic systems for the cloud age (3rd ed.). O'Reilly Media.

Rahman, A., Farhana, E., Parnin, C., & Williams, L. (2020). Gang of eight: A defect taxonomy for infrastructure as code scripts. In Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering (pp. 752-764). ACM. https://doi.org/10.1145/3377811.3380409

Rahman, A., Mahdavi-Hezaveh, R., & Williams, L. (2019). A systematic mapping study of infrastructure as code research. Information and Software Technology, 108, 65-77. https://doi.org/10.1016/j.infsof.2018.12.004

Schick, T., Dwivedi-Yu, J., Dessì, R., Raileanu, R., Lomeli, M., Hambro, E., Zettlemoyer, L., Cancedda, N., & Scialom, T. (2023). Toolformer: Language models can teach themselves to use tools. In Advances in Neural Information Processing Systems 36 (pp. 68539-68551).

Schluntz, E., & Zhang, B. (2024, December 19). Building effective agents. Anthropic. https://www.anthropic.com/engineering/building-effective-agents

Sculley, D., Holt, G., Golovin, D., Davydov, E., Phillips, T., Ebner, D., Chaudhary, V., Young, M., Crespo, J.-F., & Dennison, D. (2015). Hidden technical debt in machine learning systems. In Advances in Neural Information Processing Systems 28 (pp. 2503-2511).

Wang, L., Ma, C., Feng, X., Zhang, Z., Yang, H., Zhang, J., Chen, Z., Tang, J., Chen, X., Lin, Y., Zhao, W. X., Wei, Z., & Wen, J. (2024). A survey on large language model based autonomous agents. Frontiers of Computer Science, 18(6), Article 186345. https://doi.org/10.1007/s11704-024-40231-1

Wang, Z., Liu, Z., Zhang, Y., Zhong, A., Wang, J., Yin, F., Fan, L., Wu, L., & Wen, Q. (2024). RCAgent: Cloud root cause analysis by autonomous agents with tool-augmented large language models. In Proceedings of the 33rd ACM International Conference on Information and Knowledge Management (pp. 4966-4974). ACM. https://doi.org/10.1145/3627673.3680016

Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., & Zhou, D. (2022). Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35 (pp. 24824-24837).

Yang, J., Jimenez, C. E., Wettig, A., Lieret, K., Yao, S., Narasimhan, K., & Press, O. (2024). SWE-agent: Agent-computer interfaces enable automated software engineering. In Advances in Neural Information Processing Systems 37.

Yao, S., Zhao, J., Yu, D., Du, N., Shafran, I., Narasimhan, K., & Cao, Y. (2023). ReAct: Synergizing reasoning and acting in language models. In Proceedings of the 11th International Conference on Learning Representations. https://openreview.net/forum?id=WE_vluYUL-X

Zhang, Y., Guan, Z., Qian, H., Xu, L., Liu, H., Wen, Q., Sun, L., Jiang, J., Fan, L., & Ke, M. (2021). CloudRCA: A root cause analysis framework for cloud computing platforms. In Proceedings of the 30th ACM International Conference on Information and Knowledge Management (pp. 4373-4382). ACM. https://doi.org/10.1145/3459637.3481903

Downloads

Published

2026-10-12

How to Cite

Mane, N. (2026). DriftAgent: Using a Language Model to Turn Terraform Drift into Reviewed Merge Requests. International Journal of Computing and Engineering, 8(3), 55–73. https://doi.org/10.47941/ijce.4034

Issue

Section

Articles

Similar Articles

<< < 10 11 12 13 14 15 16 17 18 19 > >> 

You may also start an advanced similarity search for this article.