Skip to content

Commit cf86f07

Browse files
committed
fix(resource): add instance gpu_device_sepecs validator
1 parent 2977d6c commit cf86f07

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

zstack/provider/resource_zstack_instance.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import (
77
"fmt"
88
"terraform-provider-zstack/zstack/utils"
99

10+
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1011
"github.com/hashicorp/terraform-plugin-framework/attr"
1112
"github.com/hashicorp/terraform-plugin-framework/resource"
1213
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
14+
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1315
"github.com/hashicorp/terraform-plugin-framework/types"
1416
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
1517
"github.com/hashicorp/terraform-plugin-log/tflog"
@@ -251,7 +253,10 @@ func (r *vmResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp
251253
},
252254
"type": schema.StringAttribute{
253255
Optional: true,
254-
Description: "The type of the GPU device.",
256+
Description: "The type of the GPU device. Must be one of: `mdevDevice` or `pciDevice`.",
257+
Validators: []validator.String{
258+
stringvalidator.OneOf("mdevDevice", "pciDevice"),
259+
},
255260
},
256261
"number": schema.Int64Attribute{
257262
Optional: true,

0 commit comments

Comments
 (0)