Infrastructure as Code promised to redefine how developers thought about infrastructure in the age of cloud, shifting to a world where they can develop and release changes faster. But managing dynamic workloads is complex, especially when working with legacy systems.
Here’s where AI can help. A team from Thoughtworks recently showed how AI tools, guided by skilled engineers, can accelerate the modernization process, improving code quality and cutting delivery dramatically — and enabling the client to move to systems fit for the cloud era.
What was the project about?
The goal was to modernize a client’s edge infrastructure, moving away from aging VMware setups and onto Microsoft’s Azure Local platform. This wasn’t just a migration, it was a complete re-engineering effort. The team had to develop custom Terraform ‘providers’ — a plugin that acts as an interface between Terraform and an external service or platform — in Golang, and replace sprawling, outdated PowerShell scripts with modern Ansible tasks for configuration management.
What were the main challenges?
One major hurdle was the low test coverage for the new Golang Terraform providers. These were built using the recently released Terraform Plugin Framework, which had little documentation and very few public examples to draw from. With tight deadlines and a fixed-bid project scope, it was hard for the team to carve out the time needed to thoroughly understand the open-source codebase and write comprehensive tests. Coverage was stuck at around 20–30%.
The other challenge was the sheer size and complexity of the legacy PowerShell scripts. Each one ran to upwards of 1,000 lines of code and was responsible for provisioning Windows machines. The plan was to convert them into Ansible tasks — a more modern and maintainable approach — but initial estimates suggested it would take around two months to get through the 12-plus scripts.
How did AI help?
To address the testing problem, the team used an AI-assisted integrated development environment, Cursor, where its “Agent mode” could generate unit tests for the Golang providers. The entire Terraform Plugin Framework codebase was provided as context, along with a working example from AWS Terraform provider codebase, and team guided AI through the process. The first test took some back-and-forth to refine, but once the pattern was established, generating the rest became dramatically faster. In the end, test coverage leapt to 95% percent in under four hours — an obvious win for the client.
The PowerShell migration also got a major boost by using Cursor to convert legacy PowerShell scripts for Windows configuration into Ansible tasks. What had been estimated to take several days per script was completed in just a single day for one of the largest files, including conversion, testing, provisioning and validation. That speedup translated into saving two to three weeks on the overall migration timeline.
What were the key lessons learned?
The first and most important lesson was that AI can’t replace human expertise — it amplifies it. Having someone who knows “what good looks like” is essential for guiding the AI, setting the right context and validating the output. In this case, the team had expertise in Ansible, so could quickly evaluate whether the code being generated was acceptable. Without that knowledge, using AI for an unfamiliar language or framework can quickly lead to problems.
The project also highlighted the importance of effective prompting. Early interactions often require multiple iterations to help the AI lock onto the right approach, but once that pattern is in place, the process can be streamlined into a single, well-structured prompt. Knowing when to intervene and redirect the AI was just as important as the prompts themselves.
Finally, the project showed that AI tools should be factored in from the very beginning. By considering them during the discovery phase, teams can build realistic estimates, secure client approvals early, and avoid last-minute roadblocks — like the tooling restrictions in this case, where the client only approved GitHub Copilot and not Cursor.
Q: What’s the big takeaway?
AI, when paired with experienced practitioners, can transform how Infrastructure as Code projects are delivered — accelerating timelines, improving quality, and freeing teams to focus on higher-value work. But it works best when it’s built into the plan from day one, with the right human guidance and organizational alignment in place.
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.