speakeasy-api/agent-skills/generate-terraform-provider
Claude Code and agent skill by speakeasy-api/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when generating a Terraform provider from an OpenAPI spec with Speakeasy. Covers entity annotations, CRUD mapping, type inference, workflow configuration, and publishing. Triggers on "terraform provider", "generate terraform", "create terraform provider", "CRUD mapping", "x-speakeasy-entity", "terraform resource", "terraform registry".
Install
npx vskill@latest install speakeasy-api/agent-skills/generate-terraform-providerSKILL.md
generate-terraform-provider
Generate a Terraform provider from an OpenAPI specification using the Speakeasy CLI. This skill covers the full lifecycle: annotating your spec with entity metadata, mapping CRUD operations, generating the provider, configuring workflows, and publishing to the Terraform Registry.
Content Guides
| Topic | Guide | |
|---|---|---|
| Advanced Customization | content/customization.md |
The customization guide covers entity mapping placement, multi-operation resources, async polling, property customization, plan modification, validation, and state upgraders.
When to Use
- Generating a new Terraform provider from an OpenAPI spec
- Annotating an OpenAPI spec with
x-speakeasy-entityandx-speakeasy-entity-operation - Mapping API operations to Terraform CRUD methods
- Understanding Terraform type inference from OpenAPI schemas
- Configuring
workflow.yamlfor Terraform provider generation - Publishing a provider to the Terraform Registry
- User says: "terraform provider", "generate terraform", "create terraform provider", "CRUD mapping", "x-speakeasy-entity", "terraform resource", "terraform registry"
Inputs
| Input | Required | Description | |
|---|---|---|---|
| OpenAPI spec | Yes | OpenAPI 3.0 or 3.1 specification (local file, URL, or registry source) | |
| Provider name | Yes | PascalCase name for the provider (e.g., Petstore) | |
| Package name | Yes | Lowercase package identifier (e.g., petstore) | |
| Entity annotations | Yes | x-speakeasy-entity on schemas, x-speakeasy-entity-operation on operations |
Outputs
| Output | Location | |
|---|---|---|
| Workflow config | .speakeasy/workflow.yaml | |
| Generation config | gen.yaml | |
| Generated Go provider | Output directory (default: current dir) | |
| Terraform examples | examples/ directory |
Prerequisites
- Speakeasy CLI installed and authenticated
- OpenAPI 3.0 or 3.1 specification with entity annotations
- Go installed (Terraform providers are written in Go)
- Authentication: Set
SPEAKEASY_API_KEYenv var or runspeakeasy auth login
Run speakeasy auth login to authenticate interactively, or set the SPEAKEASY_API_KEY environment variable.
Command
First-time generation (quickstart)
Regenerate after changes
Regenerate a specific target
Entity Annotations
Before generating, annotate your OpenAPI spec with two extensions:
1. Mark schemas as entities
Add x-speakeasy-entity to component schemas that should become Terraform resources:
2. Map operations to CRUD methods
Add x-speakeasy-entity-operation to each API operation:
CRUD Mapping Summary
| HTTP Method | Path | Annotation | Purpose | |
|---|---|---|---|---|
POST | /resource | Entity#create | Create a new resource | |
GET | /resource/{id} | Entity#read | Read a single resource | |
PUT | /resource/{id} | Entity#update | Update a resource | |
DELETE | /resource/{id} | Entity#delete | Delete a resource |
Data sources (list): For list endpoints (GET /resources), use a separate plural entity name with #read (e.g., Pets#read). Do NOT use #list -- it is not a valid operation type.
Terraform Type Inference
Speakeasy infers Terraform schema types from the OpenAPI spec automatically:
| Rule | Condition | Terraform Attribute | |
|---|---|---|---|
| Required | Property is required in CREATE request body | Required: true | |
| Optional | Property is not required in CREATE request body | Optional: true | |
| Computed | Property appears in response but not in CREATE request | Computed: true | |
| ForceNew | Property exists in CREATE request but not in UPDATE request | ForceNew (forces resource recreation) | |
| Enum validation | Property defined as enum | Validator added for runtime checks |
Every parameter needed for READ, UPDATE, or DELETE must either appear in the CREATE response or be required in the CREATE request.
Example
Full workflow: Petstore provider
This produces a Terraform resource usable as:
Workflow Configuration
Local spec
Remote spec with overlays
For providers built against third-party APIs, fetch the spec remotely and apply local overlays:
Use speakeasy overlay compare to track upstream API changes:
Repository and Naming Conventions
Repository naming
Name the repository terraform-provider-XXX, where XXX is the provider type name. The provider type name should be lowercase alphanumeric ([a-z][a-z0-9]), though hyphens and underscores are permitted.
Entity naming
Use PascalCase for entity names so they translate correctly to Terraform's underscore naming:
| Entity Name | Terraform Resource | |
|---|---|---|
Pet | petstore_pet | |
GatewayControlPlane | konnect_gateway_control_plane | |
MeshControlPlane | konnect_mesh_control_plane |
For list data sources, use the plural PascalCase form (e.g., Pets).
Resource Importing
Generated providers support importing existing resources into Terraform state.
Simple keys
For resources with a single ID field:
Composite keys
For resources with multiple ID fields, pass a JSON-encoded object:
Or use an import block:
Then generate configuration:
Publishing to the Terraform Registry
Prerequisites
- Public repository named
terraform-provider-{name}(lowercase) - GPG signing key for release signing
- GoReleaser configuration
- Registration at registry.terraform.io
Step 1: Generate GPG Key
Step 2: Configure Repository Secrets
Add to GitHub repository secrets:
terraform_gpg_secret_key- Private key contentterraform_gpg_passphrase- Key passphrase
Step 3: Add Release Workflow
Step 4: Register with Terraform Registry
- Go to registry.terraform.io
- Sign in with GitHub (org admin required)
- Publish → Provider → Select your repository
After registration, releases auto-publish when tags are pushed.
Beta Provider Pattern
For large APIs, maintain separate stable and beta providers:
- Stable:
terraform-provider-{name}with semver (x.y.z) - Beta:
terraform-provider-{name}-betawith0.xversioning
Users can install both simultaneously. When beta features mature, graduate them to the stable provider. To set up a beta provider, create a separate terraform-provider-{name}-beta repository with its own gen.yaml using 0.x versioning, and publish it alongside the stable provider.
Testing the Provider
Add Test Dependency
In .speakeasy/gen.yaml:
Acceptance Test Structure
Running Tests
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/generate-terraform-provider/SKILL.md
Popularity
- Repository stars
- 14
- Repository forks
- 5
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 10 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/speakeasy-api/agent-skills/generate-terraform-provider)