How an AI Agent Helped Map 10,000+ Terraform Workspaces

Image for How an AI Agent Helped Map 10,000+ Terraform Workspaces

A targeted, read-only approach to infrastructure visibility and access-control risk

As enterprise infrastructure scales, even a straightforward question can become difficult to answer: Which AWS account does each Terraform Cloud workspace deploy into?

For one global enterprise, that question spanned more than 10,000 workspaces. Without a reliable workspace-to-account mapping, its platform team could not confidently move forward with a role-based access control (RBAC) cleanup. A shared Terraform Cloud role had broad access across in-scope accounts, creating a security exposure that required better visibility before permissions could be narrowed.

The Challenge: Visibility at Enterprise Scale

The team needed an accurate, repeatable way to identify the AWS account associated with each workspace, including complex configurations and inconsistent naming conventions. Manually reviewing thousands of workspaces was not a practical option.

An existing Terraform Cloud graph-querying tool was evaluated first, but it indexed workspace and run metadata rather than the state-file contents needed to identify account IDs. A dedicated configuration management database (CMDB) was another option, but it would have introduced a new system to build, maintain, and reconcile for a narrowly defined problem.

The Solution: A Purpose-Built Terraform MCP Agent

River Point Technology (RPT) recommended a more focused approach: extend HashiCorp’s Terraform Model Context Protocol (MCP) server with direct, read-only state-file querying and a tiered account-resolution skill.

The resulting AI agent could inspect Terraform state across thousands of workspaces and resolve their AWS account associations. Its approach accounted for multi-account modules, indirect references, and naming inconsistencies that made a simple static script less suitable.

Importantly, this was not a general-purpose chatbot added to an infrastructure platform. The agent was deliberately scoped to a single task, operated read-only, and used an open standard. Queries were inspectable, with answers traceable to underlying state files.

From Validation to Operational Ownership

RPT validated the solution against the client’s live environment of more than 10,000 workspaces, including account growth during the engagement. After delivery, the client’s platform team incorporated the solution into its own source repository and established continuous integration (CI) around it.

This gave the team an internally owned capability rather than another vendor-managed dashboard or standalone platform to maintain.

Addressing Credential Risk Alongside Visibility

The engagement also addressed long-lived AWS credentials. RPT selected Vault-backed dynamic credentials as the remediation approach: short-lived AWS credentials generated on demand through Vault’s AWS secrets engine and injected into HCP Terraform runs. RPT delivered a setup guide and supporting user stories to help the client implement this approach. Direct AWS OIDC was considered during research but set aside in favor of the Vault-based solution. The dynamic-credentials rollout was continuing on the client’s side as the engagement closed.

Together, these workstreams focused on the underlying security concerns: understanding account relationships and establishing a practical, targeted approach to reducing credential and access exposure.

The Outcome: A Clearer Path to Security Remediation

The client gained a validated approach to workspace-to-account mapping at enterprise scale and a maintainable capability its own platform team could operate. The engagement also provided implementation guidance for Vault-backed dynamic credentials, with rollout continuing on the client’s side.

As the client shared after the engagement: “I think ultimately, we more than hit our outcomes. We feel so much better about where we are right now and how we can go about solving a couple of the large problems that we have with our platform today.”

The Bigger Takeaway: Apply AI Where It Fits

Not every infrastructure challenge requires an AI agent. In this case, the task involved reasoning across thousands of semi-structured state records, resolving exceptions, and producing auditable results that could inform a security remediation effort.

Rather than introduce another dashboard or database, RPT built a targeted solution around the information the organization already had. The lesson is not to use AI everywhere; it is to select the smallest practical approach that solves the business and technical problem.

Ready to Improve Infrastructure Visibility?

If your platform team is managing infrastructure complexity that has outgrown existing tools, River Point Technology can help assess the challenge and identify a practical path forward. Connect with our team to discuss cloud automation, platform engineering, and security modernization.

Kevin Hospodar
AUTHORKevin Hospodar

Kevin Hospodar is a contributing author sharing expert insights on industry strategy and modern technology.

By Kevin Hospodar

Kevin Hospodar is a contributing author sharing expert insights on industry strategy and modern technology.

Back to Blogs