원클릭으로
implement-terraform-provider-resource
Implement Terraform Resources and Data Sources in `internal/provider` with comprehensive testing.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Implement Terraform Resources and Data Sources in `internal/provider` with comprehensive testing.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Accountability for identifying deprecated Lightdash API usage in the provider by comparing code patterns against the official OpenAPI specification. Use when tasked to audit the codebase for technical debt or outdated API dependencies.
Guide the execution of Lightdash Terraform provider acceptance tests, ensuring correct environment setup and targeted test execution.
Run formatting, linters, unit tests, and build checks, then fix violations.
Implement verified Lightdash API clients with documentation research and live schema verification.
Research and investigate Lightdash API endpoints to understand request/response schemas and behavior.
Comprehensive security review of the Terraform provider codebase using gosec, trunk, osv-scanner, and trivy.
| name | implement-terraform-provider-resource |
| description | Implement Terraform Resources and Data Sources in `internal/provider` with comprehensive testing. |
This skill implements a new Terraform Resource or Data Source in the internal/provider directory using the hashicorp/terraform-plugin-framework. It includes comprehensive implementation steps, unit tests, and acceptance tests following the project's established patterns.
The user should provide:
lightdash_project_agent).api.Client method(s) to use for CRUD/Read operations.internal/provider/resource_<name>.go or data_source_<name>.go.tfsdk tags. Use framework types (types.String, types.Bool, etc.).resource.Resource or datasource.DataSource.Schema method. Use descriptions from documentation.Configure method, retrieve the *api.Client from req.ProviderData.Create, Read, Update, Delete (for resources) or Read (for data sources).
api.Client or services layer methods.resp.Diagnostics) for errors.internal/provider/resource_<name>_test.go or data_source_<name>_test.go.isIntegrationTestMode() and testAccPreCheck(t).internal/provider/acc_tests/resources/<name>/ or internal/provider/acc_tests/data_sources/<name>/..tf files for different test scenarios (e.g., 010_create.tf, 020_update.tf).TestAcc... using resource.Test from github.com/hashicorp/terraform-plugin-testing/helper/resource.
ImportState: true for resource tests.resource.TestCheckResourceAttr.package provider
import (
"context"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/ubie-oss/terraform-provider-lightdash/internal/lightdash/api"
)
var _ resource.Resource = &exampleResource{}
type exampleResource struct {
client *api.Client
}
type exampleResourceModel struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
}
func (r *exampleResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
// ... Schema definition ...
}
func (r *exampleResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
// ... Create logic ...
}
func TestAccExampleResource(t *testing.T) {
if !isIntegrationTestMode() {
t.Skip("Skipping acceptance test")
}
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: providerConfig + readAccTestResource("resources/example/010_create.tf"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("lightdash_example.test", "name", "value"),
),
},
},
})
}