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.
Turn a short ticket into a landing page
Cursor’s background agent made a pricing page from a brief spec, opened a PR, and let the developer review it before shipping.
Hand small repo fixes to Cursor agents
A developer used Cursor agents to chip away at a daily batch of repo maintenance, bug fixes, and minor features.
Assign PRs and bug fixes across Cursor sub-agents
A Cursor coordinator tracked incoming pull requests and live bugs, sent sub-agents after each issue, and kept the user updated along the way.
Turn saved bookmarks into quick demo builds
A daily bookmark check can feed Cursor a new tech idea and produce a prototype after approval.
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.