Use Cursor to run Terraform through MCP
A developer used Cursor with tfmcp to plan and apply Postgres Terraform changes, then fell back to the terminal when permissions blocked the first attempt.
- What they did
- Weston Platter set up the tfmcp server, added it to Cursor’s mcp.json, and pointed it at a local Terraform folder. He then wrote a main.tf that created a Postgres role, database, and schema, and asked the agent to run terraform plan and apply. When the apply stalled on permissions, he switched to the terminal and used psql to grant CREATEROLE and CREATEDB.
- How it went
- The MCP layer did not surface the Terraform error details. Cursor’s own Run tool did show the failure and suggested setting superuser = false, after which apply succeeded. Weston said the MCP workflow was no simpler than using the command line directly.
- Tips
- If the MCP does not return useful error output, be ready to run Terraform yourself in a shell. Treat third-party MCP servers as code running on your machine, and review any plan carefully before approving changes.
Try it yourself with Cursor
Connect Cursor to my Terraform project through MCP, then run terraform plan for [resource or environment] and explain the exact changes in plain language. Stop and wait for my approval before running terraform apply or making any change that would alter infrastructure, credentials, or database permissions.
Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.
Get 3 agent uses like this every morning
With the day's top AI news. Free, and one click to unsubscribe.
Related agent uses
Flag coding conflicts before agents edit
They set up a local layer that makes coding agents announce planned changes so overlapping architecture work gets caught early.
Use Cursor to make a custom invitation site
Fabio Zapata had Cursor assemble a local invitation site with motion, images, and page links, using prompts instead of hand-coding at first.
Build a homepage from Figma in Cursor with MCP
A developer linked Figma to Cursor through MCP and used it to turn a design slice into homepage code.
Use Cursor background agents to keep docs current
Have Cursor review recent changes, update your docs, and prepare a pull request for review.
Automate Snyk fixes and PR creation
Use an agent to turn Snyk tickets into dependency updates and draft pull requests, while leaving merges for a person.
Let a background agent watch tasks and open PRs
A team keeps a server-based agent running so Cursor can monitor work and turn finished tasks into pull requests.