Terraform Actions: Extending Infrastructure Automation Beyond CRUD Operations

Overview
Terraform has become the industry standard for Infrastructure as Code (IaC). It allows teams to define, provision, and manage infrastructure across various cloud providers. At its core, Terraform uses a CRUD (Create, Read, Update, Delete) model. Resources are defined in configuration files, and Terraform manages their lifecycle through state tracking and reconciliation.
However, managing real-world infrastructure often requires tasks that go beyond this traditional CRUD model. For example, operations like invoking serverless functions after deployment, invalidating CDN caches after content updates, smoothly stopping instances, or triggering configuration management tools are imperative actions rather than simple state management. In the past, teams have managed these tasks with external scripts, CI/CD pipelines, or manual console operations, which can fragment workflows and increase maintenance efforts.
Terraform 1.14 introduces actions, a new feature that allows non-CRUD operations directly within Terraform configurations while keeping declarative principles intact. Actions bridge the gap between infrastructure provisioning and operational automation. They allow teams to define both what infrastructure should exist and what operational procedures should be executed.



