<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Puneet Gavri</title>
    <description>The latest articles on DEV Community by Puneet Gavri (@puneet_gavri_e5944e2c7cee).</description>
    <link>https://dev.to/puneet_gavri_e5944e2c7cee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3532614%2F94a1bbec-eab5-4878-ac79-a250c3cb4a58.jpg</url>
      <title>DEV Community: Puneet Gavri</title>
      <link>https://dev.to/puneet_gavri_e5944e2c7cee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/puneet_gavri_e5944e2c7cee"/>
    <language>en</language>
    <item>
      <title>Running MCP Servers Locally with Docker MCP Ecosystem: Dynamic MCP + Kiro (DIY GUIDE)</title>
      <dc:creator>Puneet Gavri</dc:creator>
      <pubDate>Sat, 07 Mar 2026 08:08:41 +0000</pubDate>
      <link>https://dev.to/puneet_gavri_e5944e2c7cee/running-mcp-servers-locally-with-docker-mcp-ecosystem-dynamic-mcp-kiro-diy-guide-42el</link>
      <guid>https://dev.to/puneet_gavri_e5944e2c7cee/running-mcp-servers-locally-with-docker-mcp-ecosystem-dynamic-mcp-kiro-diy-guide-42el</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.licdn.com%2Fdms%2Fimage%2Fv2%2FD5612AQGnkMSp-0g2Yg%2Farticle-cover_image-shrink_720_1280%2FB56Zy0NL1NHAAI-%2F0%2F1772549884435%3Fe%3D2147483647%26v%3Dbeta%26t%3DnSUZD9D1j3uxBAPWtBQXu-4sMFNj86Ds20Ir5Xlf2Gw" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.licdn.com%2Fdms%2Fimage%2Fv2%2FD5612AQGnkMSp-0g2Yg%2Farticle-cover_image-shrink_720_1280%2FB56Zy0NL1NHAAI-%2F0%2F1772549884435%3Fe%3D2147483647%26v%3Dbeta%26t%3DnSUZD9D1j3uxBAPWtBQXu-4sMFNj86Ds20Ir5Xlf2Gw" alt="Running MCP Servers Locally with Docker MCP Ecosystem: Dynamic MCP + Kiro (DIY GUIDE)" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Running MCP Servers Locally with Docker MCP Ecosystem: Dynamic MCP + Kiro (DIY GUIDE)
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="///uas/login?session_redirect=https%3A%2F%2Fwww.linkedin.com%2Fpulse%2Frunning-mcp-servers-locally-docker-ecosystem-dynamic-kiro-gavri-r63ec&amp;amp;trk=article-ssr-frontend-pulse_ellipsis-menu-semaphore-sign-in-redirect&amp;amp;guestReportContentType=PONCHO_ARTICLE&amp;amp;_f=guest-reporting"&gt;Report this article&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://in.linkedin.com/in/puneetgavri" rel="noopener noreferrer"&gt;Puneet Gavri&lt;/a&gt;&lt;br&gt;
&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Puneet Gavri"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Puneet Gavri
&lt;/h3&gt;

&lt;p&gt;Published Mar 3, 2026&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/signup/cold-join?session_redirect=%2Fpulse%2Frunning-mcp-servers-locally-docker-ecosystem-dynamic-kiro-gavri-r63ec%2F%3FtrackingId%3DLY3CXlDZTp6bLOn41cc9vw%253D%253D&amp;amp;trk=article-ssr-frontend-pulse_publisher-author-card" rel="noopener noreferrer"&gt;+ Follow&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the newsletter &lt;a href="https://www.linkedin.com/pulse/what-mcp-why-you-should-start-mcping-puneet-gavri-yp83c/?trackingId=RcQ73kaXR8iIRBGTJfAXFA%3D%3D&amp;amp;trk=article-ssr-frontend-pulse_little-text-block" rel="noopener noreferrer"&gt;What MCP Is Not… And Why You Should Start MCPing!&lt;/a&gt; , we talked about Model Context Protocol (MCP) architecture, workflow and various use-cases.&lt;/p&gt;

&lt;p&gt;In short MCP is an open-source standard that connects AI apps to external systems, enabling them to access data, tools, and workflows.&lt;/p&gt;

&lt;p&gt;But the next question is: “Okay, MCP is cool, But how and where do I run these MCP servers?" . In this article we would be talking about one of the most convenient way to run the MCP servers locally.&lt;/p&gt;

&lt;p&gt;We will explore how Docker MCP ecosystem makes MCP servers easy to discover, run, and manage locally.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  The Pain: MCP Setup Struggle
&lt;/h3&gt;

&lt;p&gt;MCP itself is elegant. The experience of running MCP servers locally? Not so much.&lt;/p&gt;

&lt;p&gt;You dig through GitHub, install different runtimes, fix dependency errors, tweak config files, restart things…One server needs Node. Another needs Python. Something else needs a specific setup. And there goes your “quick experiment.”&lt;/p&gt;




&lt;h3&gt;
  
  
  And Then Docker's MCP Ecosystem Shows Up
&lt;/h3&gt;

&lt;p&gt;Docker MCP ecosystem is made up of three pieces, each handling a different part of the MCP setup headache&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MCP Catalog Think of it as a trusted app store for MCP servers. Instead of digging through random GitHub repos, you get verified, versioned Docker containers with proper metadata and security updates and ready to run.&lt;/p&gt;

&lt;p&gt;MCP Toolkit Built into Docker Desktop, the Toolkit gives you a simple UI to browse, install, and manage MCP servers. No cloning repos. No manual config edits. Just click, install, and manage.&lt;/p&gt;

&lt;p&gt;MCP Gateway The Gateway runs the MCP containers and exposes a single endpoint for all your AI clients. Install a server once, and it’s available everywhere - Claude Desktop, Cursor, VS Code, LM Studio, and more.&lt;/p&gt;

&lt;p&gt;Put together, Discovery, setup, and connectivity all live in one place , so you spend less time configuring and more time actually using MCP.&lt;/p&gt;




&lt;h3&gt;
  
  
  What is cool about this?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No setup chaos: MCP servers come as containers. You pick one, click install, and it runs and that too "same" on every machine.&lt;/li&gt;
&lt;li&gt;Security and Isolation : Most importantly each server runs in its own container, so tools don’t get free access to your machine or your secrets.&lt;/li&gt;
&lt;li&gt;Trusted starting point: The catalog is curated and signed, so you’re not pulling random code from the internet and hoping for the best.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Great!!! you can add mcp servers with a click. But what happens when you scale??&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you add an MCP server, it doesn’t come with just one tool , it comes with all of its tools for example github official MCP server has 40 tools, terraform has 9 tools. Every tool definition gets loaded into the model at startup and Your context window starts filling up before real work even begins.&lt;/li&gt;
&lt;li&gt;Most AI models (like Claude or GPT-4) have a fixed limit on how many tools they can "see" at once (often around 128)&lt;/li&gt;
&lt;li&gt;Adding new servers may require config updates and restarts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dynamic MCP solves this problem and makes the MCP simplicity work at scale!&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Dynamic MCP?
&lt;/h2&gt;

&lt;p&gt;Dynamic MCP changes the model from “load everything upfront” to load only what you need, when you need it. Instead of preloading all tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The agent searches the MCP Catalog during the conversation and loads only the specific server required for the task&lt;/li&gt;
&lt;li&gt;It can add and configure tools live without the need to restart&lt;/li&gt;
&lt;li&gt;It asks for authentication only when a tool is triggered&lt;/li&gt;
&lt;li&gt;Compared to pre-loading all the tools, token usage is quite low.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a client connects to the MCP Gateway, it automatically gets access to a small set of built-in management tools. These tools allow the agent to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mcp-find - Search for servers in the catalog&lt;/li&gt;
&lt;li&gt;mcp-add - Add a server to the current session&lt;/li&gt;
&lt;li&gt;mcp-config-set - Update a server’s settings&lt;/li&gt;
&lt;li&gt;mcp-remove - Remove a server&lt;/li&gt;
&lt;li&gt;mcp-exec - Run any available tool in the session&lt;/li&gt;
&lt;li&gt;code-mode - Combine multiple MCP tools into a custom JavaScript-powered tool&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This capability is enabled automatically when you connect an MCP client to the toolkit. Dynamically added servers only last for the current session. When you start a new session, only the servers saved in your profile will be available.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  STEP-BY-STEP Setting up Kiro with Docker MCP Toolkit
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Docker Desktop 4.42+ (Windows) or 4.40+ (macOS) installed. If not already use this link to install it &lt;a href="https://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fwww%2Edocker%2Ecom%2Fproducts%2Fdocker-desktop%2F&amp;amp;urlhash=7TyZ&amp;amp;trk=article-ssr-frontend-pulse_little-text-block" rel="noopener noreferrer"&gt;Docker Desktop Installation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Kiro IDE latest version. To install go to &lt;a href="https://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fkiro%2Edev%2Fdownload&amp;amp;urlhash=LH7O&amp;amp;trk=article-ssr-frontend-pulse_little-text-block" rel="noopener noreferrer"&gt;https://kiro.dev/download&lt;/a&gt; and download Kiro. Once Downloaded, authenticate using one of the method as per the documentation &lt;a href="https://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fkiro%2Edev%2Fdocs%2Fgetting-started%2Fauthentication%2F&amp;amp;urlhash=iXRF&amp;amp;trk=article-ssr-frontend-pulse_little-text-block" rel="noopener noreferrer"&gt;https://kiro.dev/docs/getting-started/authentication/&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Steps:
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Step 1: Enable Docker MCP Toolkit on Docker Desktop
&lt;/h3&gt;

&lt;p&gt;Open Docker Desktop and enable the MCP Toolkit from the Settings menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;you should see MCP Toolkit in the left panel. You can see Catalog of curated MCP servers to choose from(as on date 311 and it keeps growing). My Servers tab shows the installed servers. Clients tab shows the list of clients that you can use to connect with the MCP servers. OAuth tab for authentication to MCP servers with existing credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  STEP 2: Connect Kiro as client
&lt;/h3&gt;

&lt;p&gt;On your docker desktop MCP toolkit go to Clients tab and click on connect button left to Kiro . Here you can see various other clients available as well like cursor, Codex, Gemini cli , etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  STEP 3: Restart Kiro and enable mcp agent
&lt;/h3&gt;

&lt;p&gt;Go to Kiro settings&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in the search search for "mcp" and Kiro Agent: Configure MCP parameter set it to enable (in case if if it is disabled).&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  STEP 4: Verify
&lt;/h3&gt;

&lt;p&gt;click on the Kiro icon as below, you would see MCP_DOCKER exposing the tools that we discussed above.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or you can also open the Command Palette (Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)) and find "Kiro: Open MCP Config" too view the mcp.json where the mcp servers are configured.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in mcp.josn you should see "MCP_DOCKER":{"command":"docker","args":["mcp","gateway","run"]}&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;what this does is: When Kiro needs to access MCP tools, it executes "docker mcp gateway run", which starts the Docker MCP Gateway which connects Kiro to appropriate mcp server running inside isolated containers. In short, it’s the link that lets Kiro safely use containerised tools via Docker.&lt;/p&gt;

&lt;p&gt;If you open the terminal and check the OUTPUT logs:&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You would see internal tools (like mcp-find, mcp-add, mcp-remove, mcp-exec etc) getting enabled, which means that the gateway is ready to manage and run MCP servers on the fly.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all!! Now you are good to start&lt;/p&gt;




&lt;h3&gt;
  
  
  STEP 5: Vibe!!
&lt;/h3&gt;

&lt;p&gt;To test the setup, let me give a prompt on Kiro chat to create terraform code for any aws resource and the github action workflow:&lt;/p&gt;

&lt;p&gt;PROMPT: "Use the terraform mcp, aws documentation mcp and github mcp to generate production-ready, modular Terraform code for a secure multi-AZ AWS ECS Fargate cluster following AWS Well-Architected security best practices, and also create a GitHub Actions workflow that performs IaC security scanning, Terraform validation, and plan checks before deployment. "&lt;/p&gt;

&lt;p&gt;you would see Kiro isn’t just answering. It’s dynamically discovering tools, attaching them to the session, and then using them to fetch accurate AWS documentation before generating your Terraform code.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And (Optionally) if you really want to notice that these mcp servers are running in a container in your local machine....you can!&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you ask Kiro what tools it has or just type /tools , you’ll notice it’s not a massive list. Only the tools needed for that specific task are active. If you check Currently Active MCP Tools (via Docker), you’ll see just those dynamically added servers sitting there. Nothing extra.&lt;/p&gt;

&lt;p&gt;It keeps things clean. Only what’s needed, nothing more.&lt;/p&gt;

&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img alt="Article content"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Setting up other Clients with Docker MCP toolkit
&lt;/h2&gt;

&lt;p&gt;The way we have set up Kiro to run MCP servers locally using Docker MCP toolkit, similar process can be followed for various other clients like Claude Code, Claude Desktop, Gemini CLI, Cursor etc.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Running MCP locally doesn’t have to be messy. In this article, we saw how the Docker MCP ecosystem simplifies setup, how Dynamic MCP keeps things scalable, and how easy it is to wire everything up with Kiro. Now it’s just about installing what you need, connecting your client, and building cool stuff.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>llm</category>
      <category>mcp</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Running MCP Servers Locally with Docker MCP Ecosystem: Dynamic MCP + Kiro (DIY GUIDE)</title>
      <dc:creator>Puneet Gavri</dc:creator>
      <pubDate>Sat, 07 Mar 2026 07:12:15 +0000</pubDate>
      <link>https://dev.to/puneet_gavri_e5944e2c7cee/running-mcp-servers-locally-with-docker-mcp-ecosystem-dynamic-mcp-kiro-diy-guide-6</link>
      <guid>https://dev.to/puneet_gavri_e5944e2c7cee/running-mcp-servers-locally-with-docker-mcp-ecosystem-dynamic-mcp-kiro-diy-guide-6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.licdn.com%2Fdms%2Fimage%2Fv2%2FD5612AQGnkMSp-0g2Yg%2Farticle-cover_image-shrink_720_1280%2FB56Zy0NL1NHAAI-%2F0%2F1772549884435%3Fe%3D2147483647%26v%3Dbeta%26t%3DnSUZD9D1j3uxBAPWtBQXu-4sMFNj86Ds20Ir5Xlf2Gw" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.licdn.com%2Fdms%2Fimage%2Fv2%2FD5612AQGnkMSp-0g2Yg%2Farticle-cover_image-shrink_720_1280%2FB56Zy0NL1NHAAI-%2F0%2F1772549884435%3Fe%3D2147483647%26v%3Dbeta%26t%3DnSUZD9D1j3uxBAPWtBQXu-4sMFNj86Ds20Ir5Xlf2Gw" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the newsletter What MCP Is Not… And Why You Should Start MCPing! , we talked about Model Context Protocol (MCP) architecture, workflow and various use-cases. In short MCP is an open-source standard that connects AI apps to external systems, enabling them to access data, tools, and workflows.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>docker</category>
      <category>mcp</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>TERRAFORM ACTIONS : The HashiConf '25 Drop We’ve All Been Waiting For!!!!</title>
      <dc:creator>Puneet Gavri</dc:creator>
      <pubDate>Fri, 26 Sep 2025 20:48:05 +0000</pubDate>
      <link>https://dev.to/puneet_gavri_e5944e2c7cee/terraform-actions-the-hashiconf-25-drop-weve-all-been-waiting-for-3g9</link>
      <guid>https://dev.to/puneet_gavri_e5944e2c7cee/terraform-actions-the-hashiconf-25-drop-weve-all-been-waiting-for-3g9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxmac1j6y3ulghewf2r8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxmac1j6y3ulghewf2r8.png" alt="terraform actions" width="800" height="240"&gt;&lt;/a&gt;&lt;br&gt;
At HashiConf this week, HashiCorp rolled out something many of us DevOps folks have been wishfully dreaming about: &lt;strong&gt;Terraform Actions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you've worked with Terraform for longer than five minutes, you know the philosophy: &lt;strong&gt;immutable infra only!&lt;/strong&gt; Apply, destroy, and between those two, you're not really supposed to do anything.&lt;/p&gt;

&lt;p&gt;But let's admit it, we've all done stuff. Executed a script on a VM, initiated a migration, or invoked something without modifying the &lt;code&gt;.tf&lt;/code&gt; file. Most often, the "solution" was provisioners or some other workarounds, which, if we're being honest, always seemed like duct-taping your car bumper. HashiCorp docs even do not recommend them saying: &lt;em&gt;"try not to use these."&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  So what's new?
&lt;/h2&gt;

&lt;p&gt;Terraform Actions is now a &lt;strong&gt;first-class block within HCL&lt;/strong&gt; that allows you to define what should occur between the creation and teardown of infrastructure. &lt;/p&gt;

&lt;p&gt;It's as if HashiCorp is declaring:&lt;br&gt;&lt;br&gt;
&lt;em&gt;"Fine, we know you're going to do this anyway. Here's a tidy, supported means of doing it."&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Some actual applications:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run DB migrations post-deployment of a new instance.
&lt;/li&gt;
&lt;li&gt;Rotate secrets without taking everything down.
&lt;/li&gt;
&lt;li&gt;Make config tweaks safely without violating immutability guarantees.
&lt;/li&gt;
&lt;li&gt;Invoke a Lambda, stop an AWS EC2 instance, invalidate an AWS CloudFront cache, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Terraform v1.14.0-beta2 (pre-release) just dropped yesterday (Sept 25, 2025). As of today (the very next day), in the AWS provider I only see three Actions available so far &lt;code&gt;aws_lambda_invoke&lt;/code&gt;, &lt;code&gt;aws_cloudfront_create_invalidation&lt;/code&gt;, and &lt;code&gt;aws_ec2_stop_instance&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To really see the difference between the old way and the new way, let’s take a simple example: say we need to invoke a Lambda function (yep, in AWS).&lt;/p&gt;
&lt;h3&gt;
  
  
  Before (old school way!):
&lt;/h3&gt;

&lt;p&gt;If any existing Lambda is to be invoked, we could use a data block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data "aws_lambda_invocation" "call_hellolambda" {
function_name = "hellolambda"
input = jsonencode({ })
}

output "lambda_response" {
value = data.aws_lambda_invocation.call_hellolambda.result
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sure, this works — but it runs the Lambda every single time you do &lt;code&gt;terraform apply&lt;/code&gt;. Not exactly flexible.&lt;/p&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;p&gt;If we wish to invoke the lambda just after creation, we can use a resource block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_lambda_function" "example" {
function_name = "hellolambda"
}

resource "aws_lambda_invocation" "invoke_after_creation" {
function_name = aws_lambda_function.example.function_name
depends_on = [aws_lambda_function.example]

input = jsonencode({
})
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here the Lambda gets invoked right after creation. Sounds good… until you realize it’s now stuck to the lifecycle. If nothing changes in the resource config, Terraform won’t re-invoke it.&lt;/p&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;p&gt;We were using clunky, duct-taping provisioners:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;provisioner "remote-exec" {
inline = ["aws lambda invoke --function-name hellolambda /tmp/lambda_output.txt"]
connection { ... }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the duct-tape-and-prayers method. It’ll run… until the day it doesn’t, and then you’re the lucky one ssh’ing into a box at 2 AM.&lt;/p&gt;

&lt;h2&gt;
  
  
  After Terraform Actions (the new way of On-Demand Invocations!!)
&lt;/h2&gt;

&lt;p&gt;You can configure (the new) action blocks in your Terraform configuration that are not referenced anywhere else in your code like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;action "aws_lambda_invoke" "test" {
config {
function_name = "hellolambda"
payload = jsonencode({})
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This standalone action can be triggered using the Terraform CLI. To invoke them, you use the &lt;code&gt;-invoke=&amp;lt;action address&amp;gt;&lt;/code&gt; flag with the &lt;code&gt;terraform plan&lt;/code&gt; or &lt;code&gt;terraform apply&lt;/code&gt; commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform apply -auto-approve -invoke=action.aws_lambda_invoke.test

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You would see output like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnyw1lxukyzqcdxgug9w6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnyw1lxukyzqcdxgug9w6.png" alt="cli output" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above example is just for ad-hoc action which you can trigger using the CLI. You can also bind actions to the lifecycle of a resource.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Terraform Actions Feel Like an Upgrade
&lt;/h2&gt;

&lt;p&gt;The good thing about Terraform Actions is that they finally give us a clean, native way to run operations in Terraform without resorting to hacks. A few reasons this matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can perform on-demand tasks like invoking a Lambda function, rotating a secret, stopping/starting an EC2, without tying it to the whole “create/destroy” lifecycle.
&lt;/li&gt;
&lt;li&gt;No more duct-taping SSH commands or local-exec scripts just to run a one-off task.
&lt;/li&gt;
&lt;li&gt;Actions are visible and auditable in your config, instead of tasks/operations hiding in random shell scripts.
&lt;/li&gt;
&lt;li&gt;They fit naturally into CI/CD pipelines hence safer, easier, and a lot less fragile than the workarounds most of us have been using.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;From the release notes:&lt;br&gt;&lt;br&gt;
Actions are provider-defined and meant to codify use cases outside the normal CRUD model in your Terraform configuration. Providers can define Actions like &lt;code&gt;aws_lambda_invoke&lt;/code&gt; or &lt;code&gt;aws_cloudfront_create_invalidation&lt;/code&gt; that do something imperative outside of Terraform’s normal CRUD model. You can configure such a side-effect with an action block and have actions triggered through the lifecycle of a resource or through passing the &lt;code&gt;-invoke&lt;/code&gt; CLI flag.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Terraform Actions are still in beta and starting with just a handful of examples, but honestly, it already feels like a fresh breeze after years of duct-taping solutions.&lt;/p&gt;

&lt;p&gt;It surely will ease our pain of playing with various workarounds. This was my initial reaction article on this wonderful addition by HashiCorp.&lt;/p&gt;

&lt;p&gt;Excited to explore other new features and enhancements in this latest version 1.14 and cannot wait to drop more such content in "The Devops Drop".&lt;/p&gt;

&lt;p&gt;Subscribe to &lt;strong&gt;The Devops Drop&lt;/strong&gt; on LinkedIn : &lt;a href="https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7375749694414782466" rel="noopener noreferrer"&gt;https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7375749694414782466&lt;/a&gt;&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>infrastructureascode</category>
      <category>cloud</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
