Provider Actions
Implement Terraform Provider actions using the Plugin Framework.
Install
npx skills add hashicorp/agent-skills --skill provider-actions -g -a claude-code -y- Repository
- hashicorp/agent-skills911
- Category
- DevOps
- Updated
- 7d ago
- License
- MPL-2.0
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Implement Terraform Provider actions using the Plugin Framework. Use when developing imperative operations that execute at lifecycle events (before/after create, update, destroy).
Terraform Provider Actions Implementation Guide
Overview
Terraform Actions enable imperative operations during the Terraform lifecycle. Actions are experimental features that allow performing provider operations at specific lifecycle events (before/after create, update, destroy).
References:
First Action Setup
When adding the first action to a provider that has never had one, several one-time scaffolding steps are required:
- Implement
ProviderWithActions, add anActions()method to the provider that returns[]func() action.Action. - Set
ActionDatainConfigure, the provider'sConfiguremethod must setresp.ActionData = valongside the existingResourceData,DataSourceData, andEphemeralResourceDataassignments. - Create
ActionWithConfigurebase type, if the provider uses embedded base types (e.g.ResourceWithConfigure), create an equivalentActionWithConfiguretype implementingaction.ConfigureRequest/action.ConfigureResponse. - Action-schema helper variants, if the provider injects common schema attributes (e.g.
namespace) via helper functions, action-schema variants are needed sinceaction/schematypes differ fromresource/schematypes.
File Structure
Most providers keep actions alongside resources in the provider package:
internal/provider/
├── <action_name>_action.go # Action implementation
└── <action_name>_action_test.go # Action tests
(Large multi-service providers use internal/service/<service>/ packages
instead, follow the target repository's layout.)
Documentation lives with the other generated docs:
docs/actions/
└── <action_name>.md # User-facing documentation

