provider-actions

Implement Terraform provider lifecycle actions using the Plugin Framework.

790|117|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/hashicorp/agent-skills --skill provider-actions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: provider-actions
Source: https://github.com/hashicorp/agent-skills/tree/main/terraform/provider-development/skills/provider-actions
Command: npx skills add https://github.com/hashicorp/agent-skills --skill provider-actions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraform provider developers must run imperative operations at specific lifecycle events. This Skill shows how to implement Terraform Provider Actions using the Plugin Framework to execute before/after create, update, and destroy hooks.

Core Features & Use Cases

  • Imperative lifecycle actions: run code during resource operations to enforce invariants, perform validations, or orchestrate side-effects.
  • Service structure and integration: follow standard internal/service packages and register actions with the provider.
  • Testing and reliability: guidance on testing action logic, handling timeouts, and error reporting.

Quick Start

Create a new action under the provider's internal/service package, implement the Invoke method and action schema, wire it into the service registry, and run go build and tests.

Frequently Asked Questions about provider-actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run imperative operations during Terraform resource lifecycle events?

Provider actions allow you to run imperative operations during Terraform resource lifecycle events. Using the Plugin Framework, you can implement hooks that execute before or after create, update, and destroy operations to enforce invariants or orchestrate side-effects.

How do I implement custom actions in a Terraform provider using the Plugin Framework?

Create a new action within your provider's internal/service package, define the action schema, implement the Invoke method, register the action with the service registry, and run go build and tests to verify the lifecycle integration.

What is the best way to test Terraform provider actions for lifecycle operations?

Testing Terraform provider actions involves verifying action logic, handling timeouts, and ensuring robust error reporting. You validate that before and after create, update, and destroy hooks execute correctly and report progress as expected during resource lifecycle events.

Can I use the Plugin Framework to add validation before destroying a Terraform resource?

Yes, the Plugin Framework supports provider actions that run before destroy scenarios. You can use these lifecycle hooks to perform validations, enforce invariants, or orchestrate necessary side-effects immediately prior to resource destruction.

How do I handle errors and report progress in Terraform provider actions?

Terraform provider actions support standard schemas, progress reporting, and robust error handling. When implementing the Invoke method in the Plugin Framework, you can return structured errors and report execution progress during resource lifecycle operations.