Pre-Beta Pre-beta signups are open now. The full audytx engine is live for pre-beta. Everything free today stays free — paid tiers arrive Sep 01, 2026 from $20/month for unlimited repositories.
Securing AI-generated Terraform · Cursor

Secure the Terraform Cursor writes

Cursor writes solid Terraform. In our study, AI-generated AWS config tracked hand-written modules on nearly every metric; the misses 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.

48.3
findings / 100 resources in AI-generated Terraform — on par with production's 52.2
14%
of generations fail terraform validate — often an invented security argument
85
false positives the context layer suppressed on that corpus, each with a rationale

Numbers from the audytx AI-generated Terraform study.

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 study found models 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 — one comment per 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?

No. Files are parsed in memory and discarded when the response returns — the same posture as the GitHub App path. Only aggregate scan metadata is recorded, never file contents.

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 are single-resource pattern matchers — they flag a resource for a missing attribute regardless of whether context makes it benign. audytx pre-computes relationship graphs and suppresses findings context proves harmless, with the rationale shown. For an agent, that precision is a clean fix loop instead of false-positive churn. See the benchmark comparison.

Open beta

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 — free during the beta.