Free plan Signups are open now. The full audytx engine — Terraform and CloudFormation — is live. The Free plan is 100 scans a month and stays free — paid tiers arrive Nov 01, 2026 from $20/month for unlimited repositories. Try it on your own code.
Securing AI-generated Terraform · Cursor

Secure the Terraform Cursor writes

In our June 2026 study (one model, measured on engine v0.5.1, not re-run since), the gaps in AI-written AWS config were the cross-resource kind — a secret whose rotation never gets wired up, an IAM role that can escalate through a chain no single file shows. Two small config files give Cursor a way to catch those itself, before the pull request.

Why

Fix it in the session that wrote it

The appeal of scanning inside Cursor rather than in CI is that the fix is one turn away: the agent generates the Terraform, reads the findings, and corrects them before a reviewer ever opens the diff. It cuts both ways, though. Hand the agent a report full of false positives and it will happily "fix" code that was never broken. The findings audytx returns have already been checked against the resource graph, so the ones Cursor sees are worth acting on.

Our June 2026 study scanned Terraform written by one model (Claude Opus 4.8). It was measured on engine v0.5.1 and has not been re-run on the current engine, so read its numbers on that page, with their date, and not as current figures.

Setup

Two steps

  1. Add audytx to .cursor/mcp.json

    Get a free Client ID, then add a project-level .cursor/mcp.json (or ~/.cursor/mcp.json to make it global). Cursor interpolates ${env:…}, so the ID can live in your environment instead of the committed file:

    .cursor/mcp.json
    {
      "mcpServers": {
        "audytx": {
          "url": "https://audytx.com/mcp",
          "headers": { "X-Client-ID": "${env:AUDYTX_CLIENT_ID}" }
        }
      }
    }

    This is a remote HTTP MCP server — no local process to run. Cursor picks up scan_terraform, autofix_terraform, scan_cloudformation, and the rest on the next reload.

  2. Add an always-on project rule

    Cursor reads .cursor/rules/*.mdc files, which carry frontmatter that controls when they apply. An alwaysApply rule makes the scan standing policy, not something you re-ask each time:

    .cursor/rules/audytx-terraform.mdc
    ---
    description: Scan Terraform with audytx before a PR
    alwaysApply: true
    ---
    When a change touches Terraform, call the audytx scan_terraform tool on
    the full set of .tf files in the repo — not just the diff, because
    cross-resource reasoning needs the unchanged files too. Fix every High
    and Critical finding and re-scan. Use autofix_terraform for the
    mechanical ones: it applies the sound fixes and re-scans in one pass.

    Prefer a single plain file? Cursor also reads an AGENTS.md at the project root — put the same instruction there.

That's the integration. Next time Cursor writes Terraform, the rule fires, the agent scans the whole tree, and it reads back findings with file:line evidence and remediation — fixing the High and Critical ones before the PR.
What it catches

The gaps a single-file review can't see

What you can expect it to catch — the patterns our June 2026 study found one model ship by default:

And the suppressions that keep the agent from chasing ghosts — a DLQ not asked to have its own DLQ, a role that reads privileged but can't escalate — each printed with its reasoning so the call is visible, not silent.

Also

Same engine on every other surface

The MCP loop covers pre-PR. For the review itself, install the GitHub App — a summary comment on the pull request, inline annotations, SARIF to GitHub Code Scanning — so anything the agent misses is still caught on the PR. Writing CloudFormation? The same loop works with scan_cloudformation, same rule ids and context.

FAQ

Common questions

Where does the Client ID live so it isn't committed?

Cursor expands ${env:AUDYTX_CLIENT_ID} from your shell environment, so the .cursor/mcp.json in the repo holds only the reference — the secret stays in your environment. Set AUDYTX_CLIENT_ID in your shell profile or your machine's environment.

Does audytx store the Terraform Cursor sends it?

Not the files themselves: they are parsed in memory and discarded when the response returns. audytx does keep a record of each finding (rule, message, resource, file and lines) for 90 days, then deletes it. File contents are never part of that record.

What's the difference between an .mdc rule and AGENTS.md?

Both give Cursor standing instructions. A .cursor/rules/*.mdc file carries frontmatter (description, globs, alwaysApply) that controls exactly when the rule applies — useful if you want it to fire only on Terraform paths. AGENTS.md is a plain markdown file at the project root with no metadata, applied more broadly. Either works for the audytx instruction.

How is this different from Checkov or tfsec in the same repo?

Those tools mainly check one resource at a time, so a resource missing an attribute is flagged whether or not other resources make it harmless. audytx also looks at how resources relate and shows the reason when it holds a finding back. For an agent, that means less false-positive churn in the fix loop.

Free plan

Close the loop in your next Cursor session

Add the .cursor/mcp.json entry and the project rule, and let Cursor review its own Terraform. The Free plan includes 100 scans a month.