Token导航 LogoToken导航

Agent Skill · 开发

generate-terraform-provider(生成 terraform 提供者)

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

generate-terraform-provider 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 13,983。

总安装 776周安装 33GitHub Stars 13下载 272核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:generate-terraform-provider(生成 terraform 提供者)
来源仓库:https://github.com/speakeasy-api/skills
仓库路径:skills/generate-terraform-provider
安装命令:
npx skills add https://github.com/speakeasy-api/skills --skill generate-terraform-provider
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/speakeasy-api/skills --skill generate-terraform-provider

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

辅助云资源、部署和基础设施自动化任务。适合在 Codex、Claude、Cursor、Gemini CLI 中检查配置或分析资源状态。通过 GitHub 安装,使用 npx skills add 命令添加技能。需明确目标环境、账号权限和资源组,区分测试与生产操作。

generate-terraform-provider 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/generate-terraform-provider

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/speakeasy-api/skills --skill generate-terrafor…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

generate-terraform-provider 怎么安装?

在终端执行 npx skills add https://github.com/speakeasy-api/skills --skill generate-terraform-provider。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

generate-terraform-provider 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

generate-terraform-provider 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

generate-terraform-provider 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

generate-terraform-provider 用的人多吗?

公开数据是累计安装 776 次,近一周安装 33 次,下载 272 次,GitHub 13 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

generate-terraform-provider 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
generate-terraform-provider

生成 terraform 提供者 · 本页

77613接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.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

TopicGuide
Advanced Customizationcontent/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-entity and x-speakeasy-entity-operation
  • Mapping API operations to Terraform CRUD methods
  • Understanding Terraform type inference from OpenAPI schemas
  • Configuring workflow.yaml for 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

InputRequiredDescription
OpenAPI specYesOpenAPI 3.0 or 3.1 specification (local file, URL, or registry source)
Provider nameYesPascalCase name for the provider (e.g., Petstore)
Package nameYesLowercase package identifier (e.g., petstore)
Entity annotationsYesx-speakeasy-entity on schemas, x-speakeasy-entity-operation on operations

Outputs

OutputLocation
Workflow config.speakeasy/workflow.yaml
Generation configgen.yaml
Generated Go providerOutput directory (default: current dir)
Terraform examplesexamples/ directory

Prerequisites

  1. Speakeasy CLI installed and authenticated
  2. OpenAPI 3.0 or 3.1 specification with entity annotations
  3. Go installed (Terraform providers are written in Go)
  4. Authentication: Set SPEAKEASY_API_KEY env var or run speakeasy auth login
export SPEAKEASY_API_KEY="<your-api-key>"

Run speakeasy auth login to authenticate interactively, or set the SPEAKEASY_API_KEY environment variable.

Command

First-time generation (quickstart)

speakeasy quickstart --skip-interactive --output console \
  -s <spec-path> \
  -t terraform \
  -n <ProviderName> \
  -p <package-name>

Regenerate after changes

speakeasy run --output console

Regenerate a specific target

speakeasy run -t <target-name> --output console

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:

components:
  schemas:
    Pet:
      x-speakeasy-entity: Pet
      type: object
      properties:
        id:
          type: string
          readOnly: true
        name:
          type: string
        price:
          type: number
      required:
        - name
        - price

2. Map operations to CRUD methods

Add x-speakeasy-entity-operation to each API operation:

paths:
  /pets:
    post:
      x-speakeasy-entity-operation: Pet#create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
  /pets/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    get:
      x-speakeasy-entity-operation: Pet#read
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
    put:
      x-speakeasy-entity-operation: Pet#update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
    delete:
      x-speakeasy-entity-operation: Pet#delete
      responses:
        "204":
          description: Deleted

CRUD Mapping Summary

HTTP MethodPathAnnotationPurpose
POST/resourceEntity#createCreate a new resource
GET/resource/{id}Entity#readRead a single resource
PUT/resource/{id}Entity#updateUpdate a resource
DELETE/resource/{id}Entity#deleteDelete 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:

RuleConditionTerraform Attribute
RequiredProperty is required in CREATE request bodyRequired: true
OptionalProperty is not required in CREATE request bodyOptional: true
ComputedProperty appears in response but not in CREATE requestComputed: true
ForceNewProperty exists in CREATE request but not in UPDATE requestForceNew (forces resource recreation)
Enum validationProperty defined as enumValidator 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

# 1. Ensure your spec has entity annotations (see above)

# 2. Generate the provider
speakeasy quickstart --skip-interactive --output console \
  -s ./openapi.yaml \
  -t terraform \
  -n Petstore \
  -p petstore

# 3. Build and test
cd terraform-provider-petstore
go build ./...
go test ./...

# 4. After spec changes, regenerate
speakeasy run --output console

This produces a Terraform resource usable as:

resource "petstore_pet" "my_pet" {
  name  = "Buddy"
  price = 1500
}

Workflow Configuration

Local spec

# .speakeasy/workflow.yaml
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
  my-api:
    inputs:
      - location: ./openapi.yaml
targets:
  my-provider:
    target: terraform
    source: my-api

Remote spec with overlays

For providers built against third-party APIs, fetch the spec remotely and apply local overlays:

# .speakeasy/workflow.yaml
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
  vendor-api:
    inputs:
      - location: https://api.vendor.com/openapi.yaml
    overlays:
      - location: terraform_overlay.yaml
    output: openapi.yaml
targets:
  vendor-provider:
    target: terraform
    source: vendor-api

Use speakeasy overlay compare to track upstream API changes:

speakeasy overlay compare \
  --before https://api.vendor.com/openapi.yaml \
  --after terraform_overlay.yaml \
  --out overlay-diff.yaml

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 NameTerraform Resource
Petpetstore_pet
GatewayControlPlanekonnect_gateway_control_plane
MeshControlPlanekonnect_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:

terraform import petstore_pet.my_pet my_pet_id

Composite keys

For resources with multiple ID fields, pass a JSON-encoded object:

terraform import my_test_resource.my_example \
  '{ "primary_key_one": "9cedad30-...", "primary_key_two": "e20c40a0-..." }'

Or use an import block:

import {
  id = jsonencode({
    primary_key_one: "9cedad30-..."
    primary_key_two: "e20c40a0-..."
  })
  to = my_test_resource.my_example
}

Then generate configuration:

terraform plan -generate-config-out=generated.tf

Publishing to the Terraform Registry

Prerequisites

  1. Public repository named terraform-provider-{name} (lowercase)
  2. GPG signing key for release signing
  3. GoReleaser configuration
  4. Registration at registry.terraform.io

Step 1: Generate GPG Key

gpg --full-generate-key  # Choose RSA, 4096 bits
gpg --armor --export-secret-keys YOUR_KEY_ID > private.key
gpg --armor --export YOUR_KEY_ID > public.key

Step 2: Configure Repository Secrets

Add to GitHub repository secrets:

  • terraform_gpg_secret_key - Private key content
  • terraform_gpg_passphrase - Key passphrase

Step 3: Add Release Workflow

# .github/workflows/release.yaml
name: Release
on:
  push:
    tags: ['v*']
permissions:
  contents: write

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-go@v4
        with:
          go-version-file: 'go.mod'
      - uses: crazy-max/ghaction-import-gpg@v5
        id: import_gpg
        with:
          gpg_private_key: ${{ secrets.terraform_gpg_secret_key }}
          passphrase: ${{ secrets.terraform_gpg_passphrase }}
      - uses: goreleaser/goreleaser-action@v6
        with:
          args: release --clean
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

Step 4: Register with Terraform Registry

  1. Go to registry.terraform.io
  2. Sign in with GitHub (org admin required)
  3. 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}-beta with 0.x versioning

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:

terraform:
  additionalDependencies:
    github.com/hashicorp/terraform-plugin-testing: v1.13.3

Acceptance Test Structure

// internal/provider/resource_test.go
func TestAccPet_Lifecycle(t *testing.T) {
    t.Parallel()

    resource.Test(t, resource.TestCase{
        PreCheck:                 func() { testAccPreCheck(t) },
        ProtoV6ProviderFactories: testAccProviders(),
        Steps: []resource.TestStep{
            {
                Config: testAccPetConfig("Buddy", 1500),
                Check: resource.ComposeTestCheckFunc(
                    resource.TestCheckResourceAttr("petstore_pet.test", "name", "Buddy"),
                ),
            },
            {
                ResourceName:      "petstore_pet.test",
                ImportState:       true,
                ImportStateVerify: true,
            },
        },
    })
}

Running Tests

# Unit tests
go test -v ./...

# Acceptance tests (REQUIRES TF_ACC=1)
TF_ACC=1 go test -v ./internal/provider/... -timeout 30m

Note: Without TF_ACC=1, tests silently skip with PASS status.

What NOT to Do

  • Do NOT use #list as an operation type -- only create, read, update, delete are valid
  • Do NOT modify generated Go code directly -- changes are overwritten on regeneration. Use overlays or hooks instead
  • Do NOT omit the CREATE response body -- Terraform needs the response to populate computed fields (e.g., id)
  • Do NOT skip x-speakeasy-entity on schemas -- without it, Speakeasy cannot identify Terraform resources
  • Do NOT use camelCase or snake_case for entity names -- use PascalCase so Terraform underscore naming works
  • Do NOT generate Terraform providers in monorepo mode -- HashiCorp requires a dedicated repository

Troubleshooting

ProblemCauseSolution
invalid entity operation type: listUsed #list instead of #readChange to Entity#read; list endpoints use a plural entity name
Resource missing fields after importREAD operation does not return all attributesEnsure the GET endpoint returns the complete resource schema
ForceNew on unexpected fieldField exists in CREATE but not UPDATE requestAdd the field to the UPDATE request body if it should be mutable
Provider fails to compileMissing Go dependenciesRun go mod tidy in the provider directory
Computed field not populatedField absent from CREATE responseEnsure the CREATE response returns the full resource including computed fields
Entity not appearing as resourceMissing x-speakeasy-entity annotationAdd x-speakeasy-entity: EntityName to the component schema
Auth not workingMissing API keySet SPEAKEASY_API_KEY env var or run speakeasy auth login

Related Skills

  • start-new-sdk-project - Initial project setup
  • manage-openapi-overlays - Add entity annotations via overlay
  • diagnose-generation-failure - Troubleshoot generation errors

平台分布

Codex

35.88%
按下载量换算98

Claude

28.26%
按下载量换算77

Cursor

20.21%
按下载量换算55

Gemini CLI

8.5%
按下载量换算23

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills