Security-First Evaluation of Text-to-Terraform: Benchmarking LLMs and SLMs for Secure IaC Generation
Not on the map. Why?
Abstract (arXiv)
Cloud misconfiguration remains a leading cause of security incidents, yet whether LLMs and SLMs can generate security-compliant Infrastructure-as-Code is an open question. We benchmark seven models, three closed LLMs (Claude Opus 4, GPT-5.4, Gemini 2.5 Pro) and four open SLMs (Qwen2.5-Coder-14B, WizardCoder-33B, CodeLlama-13B, Magicoder-S-CL-7B), on AWS Terraform generation across 17 scenarios, integrating Checkov and Trivy scanners into a GitLab CI/CD pipeline and evaluating two prompt strategies at three security levels (pass@5). Syntactic validity and security compliance are largely orthogonal properties in LLM-generated IaC, a model that reliably produces well-formed Terraform does not necessarily produce secure Terraform: WizardCoder-33B achieves 77.8% validate rate yet zero Checkov compliance, while Claude Opus 4 reaches 23.1% Checkov and 92.5% Trivy pass rates under detailed security prompting. Consequently, prompt engineering alone is insufficient: automated multi-tool scanning remains a necessary complement to LLM-assisted IaC generation regardless of model family or prompt strategy. All artifacts are publicly available.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 9 of its 22 references that are in the map. First posted on arXiv 2 Aug 2026.
Builds on
9 of 22 references.
References · 9
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformerscited by 1,838
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
- 2023Large Language Models for Code Analysis: Do LLMs Really Do Their Job?cited by 44
- 2022GLITCH: Automated Polyglot Security Smell Detection in Infrastructure as Codecited by 5
- 2026TerraFormer: Automated Infrastructure-as-Code with LLMs Fine-Tuned via Policy-Guided Verifier Feedbackcited by 4
- 2025Multi-IaC-Eval: Benchmarking Cloud Infrastructure as Code Across Multiple Formatscited by 2
- 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injectioncited by 2
Built on by
Not cited yet.