fix: API validation + Terraform plan-time validators
API (operator v0.1.13): - functions.go: добавлена валидация entrypoint (не пустой) и memory_mb (1-4096). Фиксирует БАГ-1/2/4 из негативных тестов. - triggers.go: добавлена валидация type (только 'http'/'cron'). Фиксирует БАГ-3 (неверное сообщение об ошибке). Провайдер (v0.1.7): - Добавлен пакет terraform-plugin-framework-validators v0.19.0 - function_resource: runtime OneOf, memory_mb 1-4096, timeout_sec 1-900 - trigger_resource: type OneOf(http, cron) - job_resource: run_id AtLeast(0) - examples/main.tf: обновлена версия до ~> 0.1.7 doc/errors/log.md: задокументированы исправления и результаты повторных тестов
This commit is contained in:
@@ -11,12 +11,14 @@ import (
|
||||
|
||||
"terraform-provider-sless/internal/client"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
@@ -69,6 +71,9 @@ func (r *TriggerResource) Schema(_ context.Context, _ resource.SchemaRequest, re
|
||||
PlanModifiers: []planmodifier.String{
|
||||
stringplanmodifier.RequiresReplace(),
|
||||
},
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOf("http", "cron"),
|
||||
},
|
||||
},
|
||||
// function: имя Function CRD в том же namespace
|
||||
"function": schema.StringAttribute{
|
||||
|
||||
Reference in New Issue
Block a user