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.

Done with Cursor· Intermediate

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.