[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"\u002Fp\u002Fsupercharge-terraform-with-mcp-servers":3},{"id":4,"title":5,"aws":6,"body":7,"categories":1552,"createdAt":1555,"description":1556,"difficulty":1557,"extension":1558,"image":1559,"links":1561,"meta":1567,"navigation":6,"path":1568,"seo":1569,"sitemap":1570,"stem":1571,"tags":1572,"toc":6,"type":1577,"updatedAt":1555,"__hash__":1578},"p\u002Fp\u002Fsupercharge-terraform-with-mcp-servers.md","Supercharge Terraform with MCP Servers",true,{"type":8,"value":9,"toc":1545},"minimark",[10,20,25,35,58,61,72,75,501,521,528,531,1033,1038,1041,1201,1213,1217,1235,1481,1484,1493,1497,1500,1529,1541],[11,12,13,14,19],"p",{},"AI assistants are great at writing Terraform, until they invent a resource argument that was removed three provider versions ago. The root cause is always the same: the model's training data is frozen in time while providers ship weekly. ",[15,16,18],"a",{"href":17},"\u002Fp\u002Fmastering-mistral-ai#connectors--mcp-servers","MCP (Model Context Protocol)"," fixes exactly that by letting your assistant query live sources instead of guessing. In this tutorial, I'll show you how to wire up the two MCP servers that make the biggest difference when programming Terraform.",[21,22,24],"h2",{"id":23},"the-terraform-mcp-server","The Terraform MCP server",[11,26,27,28,34],{},"HashiCorp ships an official ",[15,29,33],{"href":30,"rel":31},"https:\u002F\u002Fgithub.com\u002Fhashicorp\u002Fterraform-mcp-server",[32],"nofollow","Terraform MCP server"," that connects your assistant directly to the Terraform Registry. Out of the box, it exposes three families of registry tools:",[36,37,38,46,52],"ul",{},[39,40,41,45],"li",{},[42,43,44],"strong",{},"Provider tools:"," search any provider's documentation and fetch the full docs for a resource, data source, or function, always at the latest version.",[39,47,48,51],{},[42,49,50],{},"Module tools:"," discover community and verified modules, then pull their complete inputs, outputs, and examples before deciding to use one.",[39,53,54,57],{},[42,55,56],{},"Policy tools:"," browse Sentinel policies for governance and compliance requirements.",[11,59,60],{},"The server runs as a Docker container using the default stdio transport, so nothing is exposed on your network.",[62,63,64],"note",{},[11,65,66,67,71],{},"Docker must be installed and running. If you can't use Docker, HashiCorp also distributes the server as a binary via ",[68,69,70],"code",{},"go install github.com\u002Fhashicorp\u002Fterraform-mcp-server\u002Fcmd\u002Fterraform-mcp-server@latest",".",[11,73,74],{},"Here's how to register it in the most common assistants:",[76,77,78,138,285,392],"code-group",{},[79,80,86],"pre",{"className":81,"code":82,"filename":83,"language":84,"meta":85,"style":85},"language-bash shiki shiki-themes min-light min-light plastic","claude mcp add terraform -s user -t stdio -- docker run -i --rm hashicorp\u002Fterraform-mcp-server\n","Claude Code","bash","",[68,87,88],{"__ignoreMap":85},[89,90,93,97,101,104,107,111,114,117,120,123,126,129,132,135],"span",{"class":91,"line":92},"line",1,[89,94,96],{"class":95},"sOHjY","claude",[89,98,100],{"class":99},"s9CPO"," mcp",[89,102,103],{"class":99}," add",[89,105,106],{"class":99}," terraform",[89,108,110],{"class":109},"sHSBD"," -s",[89,112,113],{"class":99}," user",[89,115,116],{"class":109}," -t",[89,118,119],{"class":99}," stdio",[89,121,122],{"class":109}," --",[89,124,125],{"class":99}," docker",[89,127,128],{"class":99}," run",[89,130,131],{"class":109}," -i",[89,133,134],{"class":109}," --rm",[89,136,137],{"class":99}," hashicorp\u002Fterraform-mcp-server\n",[79,139,144],{"className":140,"code":141,"filename":142,"language":143,"meta":85,"style":85},"language-json shiki shiki-themes min-light min-light plastic","{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"hashicorp\u002Fterraform-mcp-server\"]\n    }\n  }\n}\n","Cursor","json",[68,145,146,152,173,188,214,267,273,279],{"__ignoreMap":85},[89,147,148],{"class":91,"line":92},[89,149,151],{"class":150},"slmz-","{\n",[89,153,155,159,163,166,170],{"class":91,"line":154},2,[89,156,158],{"class":157},"siOgq","  \"",[89,160,162],{"class":161},"sN-14","mcpServers",[89,164,165],{"class":157},"\"",[89,167,169],{"class":168},"skl3q",":",[89,171,172],{"class":150}," {\n",[89,174,176,179,182,184,186],{"class":91,"line":175},3,[89,177,178],{"class":157},"    \"",[89,180,181],{"class":161},"terraform",[89,183,165],{"class":157},[89,185,169],{"class":168},[89,187,172],{"class":150},[89,189,191,194,197,199,201,205,209,211],{"class":91,"line":190},4,[89,192,193],{"class":157},"      \"",[89,195,196],{"class":161},"command",[89,198,165],{"class":157},[89,200,169],{"class":168},[89,202,204],{"class":203},"sB6Cb"," \"",[89,206,208],{"class":207},"sw9Es","docker",[89,210,165],{"class":203},[89,212,213],{"class":168},",\n",[89,215,217,219,222,224,226,229,231,234,236,239,241,244,246,248,250,253,255,257,259,262,264],{"class":91,"line":216},5,[89,218,193],{"class":157},[89,220,221],{"class":161},"args",[89,223,165],{"class":157},[89,225,169],{"class":168},[89,227,228],{"class":150}," [",[89,230,165],{"class":203},[89,232,233],{"class":207},"run",[89,235,165],{"class":203},[89,237,238],{"class":168},",",[89,240,204],{"class":203},[89,242,243],{"class":207},"-i",[89,245,165],{"class":203},[89,247,238],{"class":168},[89,249,204],{"class":203},[89,251,252],{"class":207},"--rm",[89,254,165],{"class":203},[89,256,238],{"class":168},[89,258,204],{"class":203},[89,260,261],{"class":207},"hashicorp\u002Fterraform-mcp-server",[89,263,165],{"class":203},[89,265,266],{"class":150},"]\n",[89,268,270],{"class":91,"line":269},6,[89,271,272],{"class":150},"    }\n",[89,274,276],{"class":91,"line":275},7,[89,277,278],{"class":150},"  }\n",[89,280,282],{"class":91,"line":281},8,[89,283,284],{"class":150},"}\n",[79,286,288],{"className":140,"code":141,"filename":287,"language":143,"meta":85,"style":85},"Kiro",[68,289,290,294,306,318,336,380,384,388],{"__ignoreMap":85},[89,291,292],{"class":91,"line":92},[89,293,151],{"class":150},[89,295,296,298,300,302,304],{"class":91,"line":154},[89,297,158],{"class":157},[89,299,162],{"class":161},[89,301,165],{"class":157},[89,303,169],{"class":168},[89,305,172],{"class":150},[89,307,308,310,312,314,316],{"class":91,"line":175},[89,309,178],{"class":157},[89,311,181],{"class":161},[89,313,165],{"class":157},[89,315,169],{"class":168},[89,317,172],{"class":150},[89,319,320,322,324,326,328,330,332,334],{"class":91,"line":190},[89,321,193],{"class":157},[89,323,196],{"class":161},[89,325,165],{"class":157},[89,327,169],{"class":168},[89,329,204],{"class":203},[89,331,208],{"class":207},[89,333,165],{"class":203},[89,335,213],{"class":168},[89,337,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378],{"class":91,"line":216},[89,339,193],{"class":157},[89,341,221],{"class":161},[89,343,165],{"class":157},[89,345,169],{"class":168},[89,347,228],{"class":150},[89,349,165],{"class":203},[89,351,233],{"class":207},[89,353,165],{"class":203},[89,355,238],{"class":168},[89,357,204],{"class":203},[89,359,243],{"class":207},[89,361,165],{"class":203},[89,363,238],{"class":168},[89,365,204],{"class":203},[89,367,252],{"class":207},[89,369,165],{"class":203},[89,371,238],{"class":168},[89,373,204],{"class":203},[89,375,261],{"class":207},[89,377,165],{"class":203},[89,379,266],{"class":150},[89,381,382],{"class":91,"line":269},[89,383,272],{"class":150},[89,385,386],{"class":91,"line":275},[89,387,278],{"class":150},[89,389,390],{"class":91,"line":281},[89,391,284],{"class":150},[79,393,396],{"className":140,"code":394,"filename":395,"language":143,"meta":85,"style":85},"{\n  \"servers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"hashicorp\u002Fterraform-mcp-server\"]\n    }\n  }\n}\n","VS Code",[68,397,398,402,415,427,445,489,493,497],{"__ignoreMap":85},[89,399,400],{"class":91,"line":92},[89,401,151],{"class":150},[89,403,404,406,409,411,413],{"class":91,"line":154},[89,405,158],{"class":157},[89,407,408],{"class":161},"servers",[89,410,165],{"class":157},[89,412,169],{"class":168},[89,414,172],{"class":150},[89,416,417,419,421,423,425],{"class":91,"line":175},[89,418,178],{"class":157},[89,420,181],{"class":161},[89,422,165],{"class":157},[89,424,169],{"class":168},[89,426,172],{"class":150},[89,428,429,431,433,435,437,439,441,443],{"class":91,"line":190},[89,430,193],{"class":157},[89,432,196],{"class":161},[89,434,165],{"class":157},[89,436,169],{"class":168},[89,438,204],{"class":203},[89,440,208],{"class":207},[89,442,165],{"class":203},[89,444,213],{"class":168},[89,446,447,449,451,453,455,457,459,461,463,465,467,469,471,473,475,477,479,481,483,485,487],{"class":91,"line":216},[89,448,193],{"class":157},[89,450,221],{"class":161},[89,452,165],{"class":157},[89,454,169],{"class":168},[89,456,228],{"class":150},[89,458,165],{"class":203},[89,460,233],{"class":207},[89,462,165],{"class":203},[89,464,238],{"class":168},[89,466,204],{"class":203},[89,468,243],{"class":207},[89,470,165],{"class":203},[89,472,238],{"class":168},[89,474,204],{"class":203},[89,476,252],{"class":207},[89,478,165],{"class":203},[89,480,238],{"class":168},[89,482,204],{"class":203},[89,484,261],{"class":207},[89,486,165],{"class":203},[89,488,266],{"class":150},[89,490,491],{"class":91,"line":269},[89,492,272],{"class":150},[89,494,495],{"class":91,"line":275},[89,496,278],{"class":150},[89,498,499],{"class":91,"line":281},[89,500,284],{"class":150},[62,502,503],{},[11,504,505,506,509,510,513,514,517,518,71],{},"Kiro reads this from ",[68,507,508],{},".kiro\u002Fsettings\u002Fmcp.json"," (per workspace) or ",[68,511,512],{},"~\u002F.kiro\u002Fsettings\u002Fmcp.json"," (global), Cursor from ",[68,515,516],{},".cursor\u002Fmcp.json",", and VS Code from ",[68,519,520],{},".vscode\u002Fmcp.json",[11,522,523,524,527],{},"From there, your assistant stops relying on stale training data from your LLM. Ask it to write an S3 bucket with versioning and it will pull the current ",[68,525,526],{},"aws_s3_bucket"," documentation first.",[11,529,530],{},"With the configurations above, your assistant starts a fresh container on demand and talks to it over stdio. You can also run the server yourself in HTTP mode, which is handy to check that it works, or to keep a single instance running for several tools.",[532,533,536],"collapsible",{"closeText":534,"name":535,"openText":534}," ","Run the Docker image yourself",[537,538,540,545,548,563,567,570,634,651,665,669,676,740,751,755,758,1008,1012,1018],"steps",{"level":539},"4",[541,542,544],"h4",{"id":543},"pull-the-image","Pull the image",[11,546,547],{},"Download the latest version of the Terraform MCP server image:",[79,549,551],{"className":81,"code":550,"language":84,"meta":85,"style":85},"docker pull hashicorp\u002Fterraform-mcp-server:latest\n",[68,552,553],{"__ignoreMap":85},[89,554,555,557,560],{"class":91,"line":92},[89,556,208],{"class":95},[89,558,559],{"class":99}," pull",[89,561,562],{"class":99}," hashicorp\u002Fterraform-mcp-server:latest\n",[541,564,566],{"id":565},"start-the-container-in-http-mode","Start the container in HTTP mode",[11,568,569],{},"Run the image with the Streamable HTTP transport:",[79,571,573],{"className":81,"code":572,"language":84,"meta":85,"style":85},"docker run -d --rm --name terraform-mcp \\\n  -p 127.0.0.1:8080:8080 \\\n  -e TRANSPORT_MODE=streamable-http \\\n  -e TRANSPORT_HOST=0.0.0.0 \\\n  hashicorp\u002Fterraform-mcp-server:latest\n",[68,574,575,596,606,616,629],{"__ignoreMap":85},[89,576,577,579,581,584,586,589,592],{"class":91,"line":92},[89,578,208],{"class":95},[89,580,128],{"class":99},[89,582,583],{"class":109}," -d",[89,585,134],{"class":109},[89,587,588],{"class":109}," --name",[89,590,591],{"class":99}," terraform-mcp",[89,593,595],{"class":594},"s91C5"," \\\n",[89,597,598,601,604],{"class":91,"line":154},[89,599,600],{"class":109},"  -p",[89,602,603],{"class":99}," 127.0.0.1:8080:8080",[89,605,595],{"class":594},[89,607,608,611,614],{"class":91,"line":175},[89,609,610],{"class":109},"  -e",[89,612,613],{"class":99}," TRANSPORT_MODE=streamable-http",[89,615,595],{"class":594},[89,617,618,620,623,627],{"class":91,"line":190},[89,619,610],{"class":109},[89,621,622],{"class":99}," TRANSPORT_HOST=",[89,624,626],{"class":625},"sAhIg","0.0.0.0",[89,628,595],{"class":594},[89,630,631],{"class":91,"line":216},[89,632,633],{"class":99},"  hashicorp\u002Fterraform-mcp-server:latest\n",[11,635,636,639,640,643,644,647,648,71],{},[68,637,638],{},"TRANSPORT_HOST=0.0.0.0"," lets the server accept connections from outside the container, while ",[68,641,642],{},"-p 127.0.0.1:8080:8080"," publishes the port on your machine only. If port ",[68,645,646],{},"8080"," is already taken, change the first number, for example ",[68,649,650],{},"-p 127.0.0.1:18080:8080",[652,653,654],"warning",{},[11,655,656,657,660,661,664],{},"The HTTP endpoint has no authentication of its own. Keep it bound to ",[68,658,659],{},"127.0.0.1"," as shown above. If you later pass a ",[68,662,663],{},"TFE_TOKEN"," to this container, anyone who can reach the port can act with your token.",[541,666,668],{"id":667},"check-that-the-server-responds","Check that the server responds",[11,670,671,672,675],{},"Send the server an MCP ",[68,673,674],{},"initialize"," request:",[79,677,679],{"className":81,"code":678,"language":84,"meta":85,"style":85},"curl -s -X POST http:\u002F\u002Flocalhost:8080\u002Fmcp \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Accept: application\u002Fjson, text\u002Fevent-stream\" \\\n  -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{},\"clientInfo\":{\"name\":\"curl\",\"version\":\"1.0\"}}}'\n",[68,680,681,699,713,726],{"__ignoreMap":85},[89,682,683,686,688,691,694,697],{"class":91,"line":92},[89,684,685],{"class":95},"curl",[89,687,110],{"class":109},[89,689,690],{"class":109}," -X",[89,692,693],{"class":99}," POST",[89,695,696],{"class":99}," http:\u002F\u002Flocalhost:8080\u002Fmcp",[89,698,595],{"class":594},[89,700,701,704,706,709,711],{"class":91,"line":154},[89,702,703],{"class":109},"  -H",[89,705,204],{"class":203},[89,707,708],{"class":207},"Content-Type: application\u002Fjson",[89,710,165],{"class":203},[89,712,595],{"class":594},[89,714,715,717,719,722,724],{"class":91,"line":175},[89,716,703],{"class":109},[89,718,204],{"class":203},[89,720,721],{"class":207},"Accept: application\u002Fjson, text\u002Fevent-stream",[89,723,165],{"class":203},[89,725,595],{"class":594},[89,727,728,731,734,737],{"class":91,"line":190},[89,729,730],{"class":109},"  -d",[89,732,733],{"class":203}," '",[89,735,736],{"class":207},"{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{},\"clientInfo\":{\"name\":\"curl\",\"version\":\"1.0\"}}}",[89,738,739],{"class":203},"'\n",[11,741,742,743,746,747,750],{},"The response contains a ",[68,744,745],{},"serverInfo"," object with ",[68,748,749],{},"\"name\":\"terraform-mcp-server\""," and the version you're running.",[541,752,754],{"id":753},"connect-your-assistant","Connect your assistant",[11,756,757],{},"Point your assistant at the HTTP endpoint instead of letting it start Docker:",[76,759,760,784,868,929],{},[79,761,763],{"className":81,"code":762,"filename":83,"language":84,"meta":85,"style":85},"claude mcp add --transport http terraform http:\u002F\u002Flocalhost:8080\u002Fmcp\n",[68,764,765],{"__ignoreMap":85},[89,766,767,769,771,773,776,779,781],{"class":91,"line":92},[89,768,96],{"class":95},[89,770,100],{"class":99},[89,772,103],{"class":99},[89,774,775],{"class":109}," --transport",[89,777,778],{"class":99}," http",[89,780,106],{"class":99},[89,782,783],{"class":99}," http:\u002F\u002Flocalhost:8080\u002Fmcp\n",[79,785,787],{"className":140,"code":786,"filename":142,"language":143,"meta":85,"style":85},"{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"type\": \"http\",\n      \"url\": \"http:\u002F\u002Flocalhost:8080\u002Fmcp\"\n    }\n  }\n}\n",[68,788,789,793,805,817,837,856,860,864],{"__ignoreMap":85},[89,790,791],{"class":91,"line":92},[89,792,151],{"class":150},[89,794,795,797,799,801,803],{"class":91,"line":154},[89,796,158],{"class":157},[89,798,162],{"class":161},[89,800,165],{"class":157},[89,802,169],{"class":168},[89,804,172],{"class":150},[89,806,807,809,811,813,815],{"class":91,"line":175},[89,808,178],{"class":157},[89,810,181],{"class":161},[89,812,165],{"class":157},[89,814,169],{"class":168},[89,816,172],{"class":150},[89,818,819,821,824,826,828,830,833,835],{"class":91,"line":190},[89,820,193],{"class":157},[89,822,823],{"class":161},"type",[89,825,165],{"class":157},[89,827,169],{"class":168},[89,829,204],{"class":203},[89,831,832],{"class":207},"http",[89,834,165],{"class":203},[89,836,213],{"class":168},[89,838,839,841,844,846,848,850,853],{"class":91,"line":216},[89,840,193],{"class":157},[89,842,843],{"class":161},"url",[89,845,165],{"class":157},[89,847,169],{"class":168},[89,849,204],{"class":203},[89,851,852],{"class":207},"http:\u002F\u002Flocalhost:8080\u002Fmcp",[89,854,855],{"class":203},"\"\n",[89,857,858],{"class":91,"line":269},[89,859,272],{"class":150},[89,861,862],{"class":91,"line":275},[89,863,278],{"class":150},[89,865,866],{"class":91,"line":281},[89,867,284],{"class":150},[79,869,871],{"className":140,"code":870,"filename":287,"language":143,"meta":85,"style":85},"{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"url\": \"http:\u002F\u002Flocalhost:8080\u002Fmcp\"\n    }\n  }\n}\n",[68,872,873,877,889,901,917,921,925],{"__ignoreMap":85},[89,874,875],{"class":91,"line":92},[89,876,151],{"class":150},[89,878,879,881,883,885,887],{"class":91,"line":154},[89,880,158],{"class":157},[89,882,162],{"class":161},[89,884,165],{"class":157},[89,886,169],{"class":168},[89,888,172],{"class":150},[89,890,891,893,895,897,899],{"class":91,"line":175},[89,892,178],{"class":157},[89,894,181],{"class":161},[89,896,165],{"class":157},[89,898,169],{"class":168},[89,900,172],{"class":150},[89,902,903,905,907,909,911,913,915],{"class":91,"line":190},[89,904,193],{"class":157},[89,906,843],{"class":161},[89,908,165],{"class":157},[89,910,169],{"class":168},[89,912,204],{"class":203},[89,914,852],{"class":207},[89,916,855],{"class":203},[89,918,919],{"class":91,"line":216},[89,920,272],{"class":150},[89,922,923],{"class":91,"line":269},[89,924,278],{"class":150},[89,926,927],{"class":91,"line":275},[89,928,284],{"class":150},[79,930,932],{"className":140,"code":931,"filename":395,"language":143,"meta":85,"style":85},"{\n  \"servers\": {\n    \"terraform\": {\n      \"type\": \"http\",\n      \"url\": \"http:\u002F\u002Flocalhost:8080\u002Fmcp\"\n    }\n  }\n}\n",[68,933,934,938,950,962,980,996,1000,1004],{"__ignoreMap":85},[89,935,936],{"class":91,"line":92},[89,937,151],{"class":150},[89,939,940,942,944,946,948],{"class":91,"line":154},[89,941,158],{"class":157},[89,943,408],{"class":161},[89,945,165],{"class":157},[89,947,169],{"class":168},[89,949,172],{"class":150},[89,951,952,954,956,958,960],{"class":91,"line":175},[89,953,178],{"class":157},[89,955,181],{"class":161},[89,957,165],{"class":157},[89,959,169],{"class":168},[89,961,172],{"class":150},[89,963,964,966,968,970,972,974,976,978],{"class":91,"line":190},[89,965,193],{"class":157},[89,967,823],{"class":161},[89,969,165],{"class":157},[89,971,169],{"class":168},[89,973,204],{"class":203},[89,975,832],{"class":207},[89,977,165],{"class":203},[89,979,213],{"class":168},[89,981,982,984,986,988,990,992,994],{"class":91,"line":216},[89,983,193],{"class":157},[89,985,843],{"class":161},[89,987,165],{"class":157},[89,989,169],{"class":168},[89,991,204],{"class":203},[89,993,852],{"class":207},[89,995,855],{"class":203},[89,997,998],{"class":91,"line":269},[89,999,272],{"class":150},[89,1001,1002],{"class":91,"line":275},[89,1003,278],{"class":150},[89,1005,1006],{"class":91,"line":281},[89,1007,284],{"class":150},[541,1009,1011],{"id":1010},"stop-the-container","Stop the container",[11,1013,1014,1015,1017],{},"When you're done, stop the container. The ",[68,1016,252],{}," flag removes it automatically:",[79,1019,1021],{"className":81,"code":1020,"language":84,"meta":85,"style":85},"docker stop terraform-mcp\n",[68,1022,1023],{"__ignoreMap":85},[89,1024,1025,1027,1030],{"class":91,"line":92},[89,1026,208],{"class":95},[89,1028,1029],{"class":99}," stop",[89,1031,1032],{"class":99}," terraform-mcp\n",[1034,1035,1037],"h3",{"id":1036},"connect-it-to-hcp-terraform","Connect it to HCP Terraform",[11,1039,1040],{},"The registry tools work without any credentials. But if you use HCP Terraform or Terraform Enterprise, the same server can also manage your organization: listing workspaces and runs, reading plan and apply logs, browsing state versions, managing variables and variable sets, or searching your private registry. Provide a token and your assistant becomes an operator, not just a documentation reader:",[79,1042,1044],{"className":140,"code":1043,"language":143,"meta":85,"style":85},"{\n  \"mcpServers\": {\n    \"terraform\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"TFE_ADDRESS=https:\u002F\u002Fapp.terraform.io\",\n        \"-e\", \"TFE_TOKEN=\u003CYOUR_TOKEN>\",\n        \"hashicorp\u002Fterraform-mcp-server\"\n      ]\n    }\n  }\n}\n",[68,1045,1046,1050,1062,1074,1092,1105,1132,1152,1171,1180,1186,1191,1196],{"__ignoreMap":85},[89,1047,1048],{"class":91,"line":92},[89,1049,151],{"class":150},[89,1051,1052,1054,1056,1058,1060],{"class":91,"line":154},[89,1053,158],{"class":157},[89,1055,162],{"class":161},[89,1057,165],{"class":157},[89,1059,169],{"class":168},[89,1061,172],{"class":150},[89,1063,1064,1066,1068,1070,1072],{"class":91,"line":175},[89,1065,178],{"class":157},[89,1067,181],{"class":161},[89,1069,165],{"class":157},[89,1071,169],{"class":168},[89,1073,172],{"class":150},[89,1075,1076,1078,1080,1082,1084,1086,1088,1090],{"class":91,"line":190},[89,1077,193],{"class":157},[89,1079,196],{"class":161},[89,1081,165],{"class":157},[89,1083,169],{"class":168},[89,1085,204],{"class":203},[89,1087,208],{"class":207},[89,1089,165],{"class":203},[89,1091,213],{"class":168},[89,1093,1094,1096,1098,1100,1102],{"class":91,"line":216},[89,1095,193],{"class":157},[89,1097,221],{"class":161},[89,1099,165],{"class":157},[89,1101,169],{"class":168},[89,1103,1104],{"class":150}," [\n",[89,1106,1107,1110,1112,1114,1116,1118,1120,1122,1124,1126,1128,1130],{"class":91,"line":269},[89,1108,1109],{"class":203},"        \"",[89,1111,233],{"class":207},[89,1113,165],{"class":203},[89,1115,238],{"class":168},[89,1117,204],{"class":203},[89,1119,243],{"class":207},[89,1121,165],{"class":203},[89,1123,238],{"class":168},[89,1125,204],{"class":203},[89,1127,252],{"class":207},[89,1129,165],{"class":203},[89,1131,213],{"class":168},[89,1133,1134,1136,1139,1141,1143,1145,1148,1150],{"class":91,"line":275},[89,1135,1109],{"class":203},[89,1137,1138],{"class":207},"-e",[89,1140,165],{"class":203},[89,1142,238],{"class":168},[89,1144,204],{"class":203},[89,1146,1147],{"class":207},"TFE_ADDRESS=https:\u002F\u002Fapp.terraform.io",[89,1149,165],{"class":203},[89,1151,213],{"class":168},[89,1153,1154,1156,1158,1160,1162,1164,1167,1169],{"class":91,"line":281},[89,1155,1109],{"class":203},[89,1157,1138],{"class":207},[89,1159,165],{"class":203},[89,1161,238],{"class":168},[89,1163,204],{"class":203},[89,1165,1166],{"class":207},"TFE_TOKEN=\u003CYOUR_TOKEN>",[89,1168,165],{"class":203},[89,1170,213],{"class":168},[89,1172,1174,1176,1178],{"class":91,"line":1173},9,[89,1175,1109],{"class":203},[89,1177,261],{"class":207},[89,1179,855],{"class":203},[89,1181,1183],{"class":91,"line":1182},10,[89,1184,1185],{"class":150},"      ]\n",[89,1187,1189],{"class":91,"line":1188},11,[89,1190,272],{"class":150},[89,1192,1194],{"class":91,"line":1193},12,[89,1195,278],{"class":150},[89,1197,1199],{"class":91,"line":1198},13,[89,1200,284],{"class":150},[652,1202,1203],{},[11,1204,1205,1206,1209,1210,1212],{},"Destructive operations (applying runs, deleting workspaces) are disabled by default and require explicitly setting ",[68,1207,1208],{},"ENABLE_TF_OPERATIONS=true",". Leave it off unless you really want your assistant pressing the apply button, and scope the ",[68,1211,663],{}," permissions to the minimum needed.",[21,1214,1216],{"id":1215},"the-aws-knowledge-mcp-server","The AWS Knowledge MCP server",[11,1218,1219,1220,1224,1225,1228,1229,1234],{},"Provider docs tell your assistant ",[1221,1222,1223],"em",{},"how"," to write a resource, but not always ",[1221,1226,1227],{},"which"," AWS architecture makes more sense. If your Terraform targets AWS, pairing the Terraform server with the ",[15,1230,1233],{"href":1231,"rel":1232},"https:\u002F\u002Fawslabs.github.io\u002Fmcp\u002Fservers\u002Faws-knowledge-mcp-server",[32],"AWS Knowledge MCP server"," is a nice combo: it's a fully managed remote server hosted by AWS that exposes the AWS documentation, API references, architectural guidance, Well-Architected best practices, and even the regional availability of each service and API. No container, no credentials, not even an AWS account, just an URL:",[76,1236,1237,1260,1341,1402],{},[79,1238,1240],{"className":81,"code":1239,"filename":83,"language":84,"meta":85,"style":85},"claude mcp add --transport http aws-knowledge https:\u002F\u002Fknowledge-mcp.global.api.aws\n",[68,1241,1242],{"__ignoreMap":85},[89,1243,1244,1246,1248,1250,1252,1254,1257],{"class":91,"line":92},[89,1245,96],{"class":95},[89,1247,100],{"class":99},[89,1249,103],{"class":99},[89,1251,775],{"class":109},[89,1253,778],{"class":99},[89,1255,1256],{"class":99}," aws-knowledge",[89,1258,1259],{"class":99}," https:\u002F\u002Fknowledge-mcp.global.api.aws\n",[79,1261,1263],{"className":140,"code":1262,"filename":142,"language":143,"meta":85,"style":85},"{\n  \"mcpServers\": {\n    \"aws-knowledge\": {\n      \"type\": \"http\",\n      \"url\": \"https:\u002F\u002Fknowledge-mcp.global.api.aws\"\n    }\n  }\n}\n",[68,1264,1265,1269,1281,1294,1312,1329,1333,1337],{"__ignoreMap":85},[89,1266,1267],{"class":91,"line":92},[89,1268,151],{"class":150},[89,1270,1271,1273,1275,1277,1279],{"class":91,"line":154},[89,1272,158],{"class":157},[89,1274,162],{"class":161},[89,1276,165],{"class":157},[89,1278,169],{"class":168},[89,1280,172],{"class":150},[89,1282,1283,1285,1288,1290,1292],{"class":91,"line":175},[89,1284,178],{"class":157},[89,1286,1287],{"class":161},"aws-knowledge",[89,1289,165],{"class":157},[89,1291,169],{"class":168},[89,1293,172],{"class":150},[89,1295,1296,1298,1300,1302,1304,1306,1308,1310],{"class":91,"line":190},[89,1297,193],{"class":157},[89,1299,823],{"class":161},[89,1301,165],{"class":157},[89,1303,169],{"class":168},[89,1305,204],{"class":203},[89,1307,832],{"class":207},[89,1309,165],{"class":203},[89,1311,213],{"class":168},[89,1313,1314,1316,1318,1320,1322,1324,1327],{"class":91,"line":216},[89,1315,193],{"class":157},[89,1317,843],{"class":161},[89,1319,165],{"class":157},[89,1321,169],{"class":168},[89,1323,204],{"class":203},[89,1325,1326],{"class":207},"https:\u002F\u002Fknowledge-mcp.global.api.aws",[89,1328,855],{"class":203},[89,1330,1331],{"class":91,"line":269},[89,1332,272],{"class":150},[89,1334,1335],{"class":91,"line":275},[89,1336,278],{"class":150},[89,1338,1339],{"class":91,"line":281},[89,1340,284],{"class":150},[79,1342,1344],{"className":140,"code":1343,"filename":287,"language":143,"meta":85,"style":85},"{\n  \"mcpServers\": {\n    \"aws-knowledge\": {\n      \"url\": \"https:\u002F\u002Fknowledge-mcp.global.api.aws\"\n    }\n  }\n}\n",[68,1345,1346,1350,1362,1374,1390,1394,1398],{"__ignoreMap":85},[89,1347,1348],{"class":91,"line":92},[89,1349,151],{"class":150},[89,1351,1352,1354,1356,1358,1360],{"class":91,"line":154},[89,1353,158],{"class":157},[89,1355,162],{"class":161},[89,1357,165],{"class":157},[89,1359,169],{"class":168},[89,1361,172],{"class":150},[89,1363,1364,1366,1368,1370,1372],{"class":91,"line":175},[89,1365,178],{"class":157},[89,1367,1287],{"class":161},[89,1369,165],{"class":157},[89,1371,169],{"class":168},[89,1373,172],{"class":150},[89,1375,1376,1378,1380,1382,1384,1386,1388],{"class":91,"line":190},[89,1377,193],{"class":157},[89,1379,843],{"class":161},[89,1381,165],{"class":157},[89,1383,169],{"class":168},[89,1385,204],{"class":203},[89,1387,1326],{"class":207},[89,1389,855],{"class":203},[89,1391,1392],{"class":91,"line":216},[89,1393,272],{"class":150},[89,1395,1396],{"class":91,"line":269},[89,1397,278],{"class":150},[89,1399,1400],{"class":91,"line":275},[89,1401,284],{"class":150},[79,1403,1405],{"className":140,"code":1404,"filename":395,"language":143,"meta":85,"style":85},"{\n  \"servers\": {\n    \"aws-knowledge\": {\n      \"type\": \"http\",\n      \"url\": \"https:\u002F\u002Fknowledge-mcp.global.api.aws\"\n    }\n  }\n}\n",[68,1406,1407,1411,1423,1435,1453,1469,1473,1477],{"__ignoreMap":85},[89,1408,1409],{"class":91,"line":92},[89,1410,151],{"class":150},[89,1412,1413,1415,1417,1419,1421],{"class":91,"line":154},[89,1414,158],{"class":157},[89,1416,408],{"class":161},[89,1418,165],{"class":157},[89,1420,169],{"class":168},[89,1422,172],{"class":150},[89,1424,1425,1427,1429,1431,1433],{"class":91,"line":175},[89,1426,178],{"class":157},[89,1428,1287],{"class":161},[89,1430,165],{"class":157},[89,1432,169],{"class":168},[89,1434,172],{"class":150},[89,1436,1437,1439,1441,1443,1445,1447,1449,1451],{"class":91,"line":190},[89,1438,193],{"class":157},[89,1440,823],{"class":161},[89,1442,165],{"class":157},[89,1444,169],{"class":168},[89,1446,204],{"class":203},[89,1448,832],{"class":207},[89,1450,165],{"class":203},[89,1452,213],{"class":168},[89,1454,1455,1457,1459,1461,1463,1465,1467],{"class":91,"line":216},[89,1456,193],{"class":157},[89,1458,843],{"class":161},[89,1460,165],{"class":157},[89,1462,169],{"class":168},[89,1464,204],{"class":203},[89,1466,1326],{"class":207},[89,1468,855],{"class":203},[89,1470,1471],{"class":91,"line":269},[89,1472,272],{"class":150},[89,1474,1475],{"class":91,"line":275},[89,1476,278],{"class":150},[89,1478,1479],{"class":91,"line":281},[89,1480,284],{"class":150},[11,1482,1483],{},"With both servers connected, the division of labor is neat: the AWS Knowledge server helps design the architecture and confirms a service is available in your target region, while the Terraform server makes sure the generated code matches the current provider schema.",[62,1485,1486],{},[11,1487,1488,1489,1492],{},"AWS used to maintain a dedicated ",[68,1490,1491],{},"awslabs.terraform-mcp-server"," with Checkov integration, but it's now deprecated in favor of HashiCorp's official server and no longer receives updates. If you still have it configured, it's time to migrate.",[21,1494,1496],{"id":1495},"put-them-to-work","Put them to work",[11,1498,1499],{},"Once configured, your assitant trigger automatically when your questions touch their domain. A few prompts that show the difference:",[36,1501,1502,1511,1517,1523],{},[39,1503,1504,1510],{},[1221,1505,1506,1507,1509],{},"\"Write an ",[68,1508,526],{}," with versioning and lifecycle rules using the current provider syntax\"",", pulls the latest provider docs instead of recalling deprecated arguments.",[39,1512,1513,1516],{},[1221,1514,1515],{},"\"Is there a verified module for an EKS cluster? Compare its inputs with writing the resources myself\"",", fetches real module documentation with download counts and verification status.",[39,1518,1519,1522],{},[1221,1520,1521],{},"\"Review this VPC configuration against AWS best practices\"",", combines Well-Architected guidance with the current provider schema.",[39,1524,1525,1528],{},[1221,1526,1527],{},"\"Which of my workspaces failed their last run, and why?\"",", reads run logs straight from HCP Terraform (token required).",[11,1530,1531,1532,1535,1536,1540],{},"One last tip to close the loop: these servers make your assistant accurate, but they don't make ",[68,1533,1534],{},"terraform apply"," safe. Keep the actual deployment in a controlled pipeline with plan review and least-privilege roles, exactly like the workflow I describe in ",[15,1537,1539],{"href":1538},"\u002Fp\u002Fdeploy-aws-terraform-github-actions","Deploy Your Terraform IaC with GitHub Actions",". Let AI write the Terraform code, and let your CI\u002FCD ship it.",[1542,1543,1544],"style",{},"html pre.shiki code .sOHjY, html code.shiki .sOHjY{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#B57EDC}html pre.shiki code .s9CPO, html code.shiki .s9CPO{--shiki-light:#2B5581;--shiki-default:#2B5581;--shiki-dark:#98C379}html pre.shiki code .sHSBD, html code.shiki .sHSBD{--shiki-light:#2B5581;--shiki-default:#2B5581;--shiki-dark:#56B6C2}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .slmz-, html code.shiki .slmz-{--shiki-light:#24292EFF;--shiki-default:#24292EFF;--shiki-dark:#A9B2C3}html pre.shiki code .siOgq, html code.shiki .siOgq{--shiki-light:#D32F2F;--shiki-default:#D32F2F;--shiki-dark:#A9B2C3}html pre.shiki code .sN-14, html code.shiki .sN-14{--shiki-light:#D32F2F;--shiki-default:#D32F2F;--shiki-dark:#C6CCD7}html pre.shiki code .skl3q, html code.shiki .skl3q{--shiki-light:#212121;--shiki-default:#212121;--shiki-dark:#A9B2C3}html pre.shiki code .sB6Cb, html code.shiki .sB6Cb{--shiki-light:#22863A;--shiki-default:#22863A;--shiki-dark:#A9B2C3}html pre.shiki code .sw9Es, html code.shiki .sw9Es{--shiki-light:#22863A;--shiki-default:#22863A;--shiki-dark:#98C379}html pre.shiki code .s91C5, html code.shiki .s91C5{--shiki-light:#24292EFF;--shiki-default:#24292EFF;--shiki-dark:#56B6C2}html pre.shiki code .sAhIg, html code.shiki .sAhIg{--shiki-light:#1976D2;--shiki-default:#1976D2;--shiki-dark:#56B6C2}",{"title":85,"searchDepth":154,"depth":154,"links":1546},[1547,1550,1551],{"id":23,"depth":154,"text":24,"children":1548},[1549],{"id":1036,"depth":175,"text":1037},{"id":1215,"depth":154,"text":1216},{"id":1495,"depth":154,"text":1496},[1553,1554],"AI","DevOps","2026-10-07","Connect your AI assistant to the official Terraform MCP server and the AWS Knowledge MCP server to generate accurate, up-to-date HCL instead of hallucinated resources.","L200","md",{"src":1560},"\u002Fcovers\u002Fsupercharge-terraform-with-mcp-servers.jpg",{"tools":1562},[1563],{"label":1564,"icon":1565,"to":1566},"Terraform","logos:terraform-icon","\u002Fr\u002Fterraform",{},"\u002Fp\u002Fsupercharge-terraform-with-mcp-servers",{"title":5,"description":1556},{"loc":1568,"lastmod":1555},"p\u002Fsupercharge-terraform-with-mcp-servers",[1573,1574,1575,1576],"Agent","IaC","LLM","MCP","Tutorial","8bPb2u-3tVat511fhdIv6ibuVwF4R5Pi9nf8_aKCHbg"]