<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe" -->

---
title: Terraform Action Block: Syntax, Triggers &amp; Examples
description: Terraform 1.14 introduced the action block, a new language construct for declaring imperative, provider-defined operations that run outside the normal CRUD...
canonical: https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Terraform Action Block: Syntax, Triggers &amp; Examples | daily.dev
og:description: Terraform 1.14 introduced the action block, a new language construct for declaring imperative, provider-defined operations that run outside the normal CRUD...
og:url: https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe
og:image: https://api.daily.dev/og/posts/2y6KdaZXe.png
og:image:alt: Terraform Action Block: Syntax, Triggers &amp; Examples
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform Action Block: Syntax, Triggers & Examples

**[Spacelift](https://daily.dev/sources/spacelift)** · 12 min read · 5 upvotes · 0 comments

## Summary

Terraform 1.14 introduced the action block, a new language construct for declaring imperative, provider-defined operations that run outside the normal CRUD lifecycle. Unlike resources, actions are stateless and not tracked in state. They replace workarounds like null_resource, local-exec provisioners, and bash scripts. Actions can be invoked two ways: via the CLI using `terraform apply -invoke`, or automatically through an `action_trigger` block bound to a resource's lifecycle events (before_create, after_create, before_update, after_update). Provider support is currently limited to AWS, Azure, Local, and Ansible. Key limitations include no destroy-time triggers, no plan-time result visibility, no result-based dependencies, and potential blocking of long applies. Practical use cases include CDN cache invalidation, Lambda-based schema migrations, VM power management, cost-saving EC2 scheduling, deployment notifications, and smoke tests.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://spacelift.io/blog/terraform-actions>

## Similar posts on daily.dev

- [How Terraform Works](https://daily.dev/posts/how-terraform-works-m4paeflla) · System Design Codex · 35 upvotes · 0 comments

---

Tags: [#aws](https://daily.dev/tags/aws), [#terraform](https://daily.dev/tags/terraform), [#iac](https://daily.dev/tags/iac), [#hashicorp](https://daily.dev/tags/hashicorp)

[View this post on daily.dev](https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Terraform Action Block: Syntax, Triggers & Examples","url":"https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe"},"datePublished":"2026-06-19T08:40:36.454Z","dateModified":"2026-06-19T08:44:02.321Z","description":"Terraform 1.14 introduced the action block, a new language construct for declaring imperative, provider-defined operations that run outside the normal CRUD...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/350359beeeaba6a6afc4fbed9ab257b4?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/350359beeeaba6a6afc4fbed9ab257b4?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Spacelift","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Spacelift","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/422b4004f7b24dc988e5720eca3accfc","url":"https://daily.dev/sources/spacelift"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/terraform-action-block-syntax-triggers-examples-2y6kdazxe","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"aws,terraform,iac,hashicorp","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Spacelift","item":"https://daily.dev/sources/spacelift"},{"@type":"ListItem","position":3,"name":"Terraform Action Block: Syntax, Triggers & Examples"}]}
```

