This commit is contained in:
asteam
2025-07-01 13:44:09 +03:00
parent 5382579a5f
commit ddbb12996d
1041 changed files with 2842 additions and 96448 deletions

View File

@@ -1,11 +1,10 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"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/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"
)
@@ -24,10 +23,6 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
Required: true,
Description: "size in GB, default is 10",
},
"gid": schema.Int64Attribute{
Required: true,
Description: "ID of the grid (platform)",
},
// optional attributes
"desc": schema.StringAttribute{
@@ -46,23 +41,21 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
Description: "Storage endpoint provider ID to create disk",
},
"type": schema.StringAttribute{
Optional: true,
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("B", "D", "T"), // case is not ignored
},
Computed: true,
Description: "(B;D;T) B=Boot;D=Data;T=Temp",
// default is D
},
"detach": schema.BoolAttribute{
Optional: true,
Computed: true,
Description: "Detaching the disk from compute",
// default is false
Default: booldefault.StaticBool(true),
},
"permanently": schema.BoolAttribute{
Optional: true,
Computed: true,
Description: "Whether to completely delete the disk, works only with non attached disks",
// default is false
Default: booldefault.StaticBool(true),
},
"shareable": schema.BoolAttribute{
Optional: true,
@@ -170,9 +163,15 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
},
},
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
@@ -187,12 +186,22 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
},
"images": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
ElementType: types.Int64Type,
},
"gid": schema.Int64Attribute{
Computed: true,
Description: "ID of the grid (platform)",
},
"last_updated": schema.StringAttribute{
Computed: true,
Description: "Timestamp of the last Terraform update of the disk resource.",
},
"machine_id": schema.Int64Attribute{
Computed: true,
},
"machine_name": schema.StringAttribute{
Computed: true,
},
"order": schema.Int64Attribute{
Computed: true,
},
@@ -205,7 +214,7 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
"pci_slot": schema.Int64Attribute{
Computed: true,
},
"present_to": schema.ListAttribute{
"present_to": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
@@ -258,6 +267,12 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
"tech_status": schema.StringAttribute{
Computed: true,
},
"updated_by": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"vmid": schema.Int64Attribute{
Computed: true,
},