[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-86563-en":3,"doc-seo-86563-105":30,"detail-sidebar-cat-0-en-105":92},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":21,"is_downloadable":21,"audit_status":21,"page_count":22,"language":23,"language_code":24,"site_id":25,"html_lang":24,"table_of_contents":26,"faqs":27,"seo_title":13,"seo_description":14,"update_tm":28,"read_time":29},86563,687197207919,"Theodora","https://ap-avatar.wpscdn.com/avatar/a000253d6f5f7c60be?x-image-process=image/resize,m_fixed,w_180,h_180&k=1779446848396160552",8,"Research & Report","TerraRepair: A Tool-Grounded LLM Agent for Infrastructure-as-Code Repair","Infrastructure-as-Code (IaC) scanners can detect cloud misconfigurations in Terraform, yet repairing flagged issues often remains manual. Tool-grounded LLM repair can generate invalid or unsupported constructs and may suppress warnings without addressing the underlying security problem. TerraRepair explores whether grounding improves Terraform repair by retrieving dependency context, consulting provider schemas, re-running scanners, and escalating when deployment-specific context is missing. Evaluations on Checkov and Trivy show large increases in scanner-verified fix rates across AWS, Azure, and GCP.","arXiv :2607 . 1 1390v 1 [ cs . SE] 13 Jul 2026  \nTerraRepair: A Tool-Grounded LLM Agent for Infrastructure-as-Code Repair  \nMinase Mekete Mengistu \\#   \nUniversity of L’Aquila, Italy Juri Di Rocco \\#  University of L’Aquila, Italy Phuong T. Nguyen \\#  University of L’Aquila, Italy Davide Di Ruscio \\#  University of L’Aquila, Italy  \n~~ Abstract  ~~Background: Infrastructure-as-Code (IaC) scanners detect cloud misconfigurations in Terraform and other IaC languages before deployment, but repairing the flagged configurations remains largely manual. Recent Large Language Model (LLM)-based repair approaches can repair some findings, but may hallucinate unsupported constructs or suppress warnings without fixing the issue.  \nAims: We study whether tool grounding can improve LLM-based Terraform repair, and when a finding should be escalated because the required deployment-specific context is not available. Method: We present TerraRepair, a prototype of a tool-grounded LLM agent for Terraform repair with structured escalation. TerraRepair retrieves dependency context from Terraform references, consults the installed provider schema, and re-runs the scanner before returning a candidate repair. When the required context is absent, TerraRepair escalates instead of fabricating a plausible fix. Results: We evaluate our tool on two vulnerable-by-design Terraform repositories using two IaC security scanners, Checkov and Trivy, across AWS, Azure, and GCP. On the combined AWS benchmark, TerraRepair improves scanner-verified fix rates from 26.6% to 78.4% on Checkov and from 44 .8% to 72 .4% on Trivy, compared with a controlled one-shot baseline. It also reduces the baseline’s 44.8–73.6 percentage point (pp) claimed-vs-verified repair gap to under 5 pp. In a sampled semantic audit, 78.9% of TerraRepair’s scanner-verified AWS repairs are labeled as correct under a majority-vote protocol.  \nConclusions: These emerging results show that tool grounding can substantially improve scannerverified LLM-based IaC repair on the studied benchmarks, while missing deployment-specific context remains the main knowledge boundary for full autonomy.  \n2012 ACM Subject Classification Software and its engineering → Software maintenance tools; Software and its engineering → Software defect analysis; Security and privacy → Software security engineering  \nKeywords and phrases Infrastructure as Code, automated repair, large language models, cloud security  \nDigital Object Identifier 10.4230/LIPIcs.ESEM.2026.XX  \n 1  Introduction  \nInfrastructure as Code (IaC) is widely used to provision and manage cloud infrastructure through declarative configuration files, such as Terraform modules written in HashiCorp Configuration Language (HCL) [15, 8] . This practice improves repeatability, reviewability, and automation, but it also moves cloud security and reliability risks into code [6] . Misconfigured IaC can expose storage buckets, grant overly broad Identity and Access Management (IAM) permissions, disable encryption, or leave network access unrestricted. Prior work has studied such recurring weaknesses as IaC security smells [20] .  \n© Author: Please provide a copyright holder;  \nlicensed under Creative Commons License CC-BY 4.0  \nInternational Symposium on Empirical Software Engineering and Measurement (ESEM 2026) .  \nEditor: Anonymous; Article No. XX; pp. XX:1–XX:13  \nLeibniz International Proceedings in Informatics  \n Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany  \nXX:2 TerraRepair: A Tool-Grounded LLM Agent for Infrastructure-as-Code Repair  \nIaC security scanners detect many of these issues before deployment by reporting policy violations over Terraform resources [6, 17 , 3] . However, detection is only the first step. Developers must still determine how to modify the affected resource, whether related resources must also be changed, and whether the repair is valid for the installed Terraform provider version. Many repairs also require ","cbCaip5YABDLKjNf","https://ap.wps.com/l/cbCaip5YABDLKjNf","pdf",913797,6,1,13,"English","en",105,"# Introduction\n## Motivation and Problem Setting\n## Limitations of LLM-Based Repair\n## TerraRepair Approach","[{\"question\":\"What problem does TerraRepair address in Infrastructure-as-Code repair?\",\"answer\":\"IaC scanners report Terraform misconfigurations, but turning findings into correct repairs is largely manual. Existing LLM repair methods can hallucinate unsupported constructs or clear warnings without fixing the real security issue.\"},{\"question\":\"How does TerraRepair ground LLM repairs for Terraform?\",\"answer\":\"TerraRepair retrieves dependency context from Terraform references, consults the installed provider schema, and re-runs the scanner on candidate repairs to validate the outcome.\"},{\"question\":\"When does TerraRepair escalate instead of producing a fix?\",\"answer\":\"When required deployment-specific context is absent, TerraRepair escalates rather than fabricating a plausible repair that cannot be grounded in the available information.\"}]",1784212652,33,{"code":4,"msg":31,"data":32},"ok",{"site_id":25,"language":24,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":87,"head_meta":89,"extra_data":91,"updated_unix":28},"terrarepair-a-tool-grounded-llm-agent-for-infrastructure-as-code-repair","",{"@graph":36,"@context":86},[37,54,69],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":21},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/research-report/",3,{"item":52,"name":13,"@type":43,"position":53},"https://docshare.wps.com/document/terrarepair-a-tool-grounded-llm-agent-for-infrastructure-as-code-repair/86563/",4,{"url":52,"name":13,"@type":55,"author":56,"headline":13,"publisher":58,"fileFormat":61,"inLanguage":24,"description":14,"dateModified":62,"datePublished":63,"encodingFormat":61,"isAccessibleForFree":64,"interactionStatistic":65},"DigitalDocument",{"name":9,"@type":57},"Person",{"url":41,"name":59,"@type":60},"DocShare","Organization","application/pdf","2026-07-26","2026-07-16",true,{"@type":66,"interactionType":67,"userInteractionCount":20},"InteractionCounter",{"@type":68},"ViewAction",{"@type":70,"mainEntity":71},"FAQPage",[72,78,82],{"name":73,"@type":74,"acceptedAnswer":75},"What problem does TerraRepair address in Infrastructure-as-Code repair?","Question",{"text":76,"@type":77},"IaC scanners report Terraform misconfigurations, but turning findings into correct repairs is largely manual. Existing LLM repair methods can hallucinate unsupported constructs or clear warnings without fixing the real security issue.","Answer",{"name":79,"@type":74,"acceptedAnswer":80},"How does TerraRepair ground LLM repairs for Terraform?",{"text":81,"@type":77},"TerraRepair retrieves dependency context from Terraform references, consults the installed provider schema, and re-runs the scanner on candidate repairs to validate the outcome.",{"name":83,"@type":74,"acceptedAnswer":84},"When does TerraRepair escalate instead of producing a fix?",{"text":85,"@type":77},"When required deployment-specific context is absent, TerraRepair escalates rather than fabricating a plausible repair that cannot be grounded in the available information.","https://schema.org",{"og:url":52,"og:type":88,"og:title":13,"og:site_name":59,"og:description":14},"article",{"robots":90,"canonical":52},"index,follow",{"doc_id":7,"site_id":25},{"code":4,"msg":5,"data":93},[94,98,102,106,111,115,120,123,128,131,135],{"id":21,"doc_module":4,"doc_module_name":46,"category_name":95,"show_sort_weight":96,"slug":97},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":99,"show_sort_weight":100,"slug":101},"Literature",80,"literature",{"id":53,"doc_module":4,"doc_module_name":46,"category_name":103,"show_sort_weight":104,"slug":105},"Exam",70,"exam",{"id":107,"doc_module":4,"doc_module_name":46,"category_name":108,"show_sort_weight":109,"slug":110},5,"Comic",60,"comic",{"id":20,"doc_module":4,"doc_module_name":46,"category_name":112,"show_sort_weight":113,"slug":114},"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":46,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":121,"slug":122},30,"research-report",{"id":124,"doc_module":4,"doc_module_name":46,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":46,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":46,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":46,"category_name":137,"show_sort_weight":107,"slug":138},19,"General","general"]