This commit is contained in:
asteam
2024-12-04 13:18:58 +03:00
parent 003e4d656e
commit 76ea459b3d
417 changed files with 30051 additions and 975 deletions

View File

@@ -160,6 +160,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"arch": schema.StringAttribute{
Computed: true,
},
"chipset": schema.StringAttribute{
Computed: true,
},
"boot_order": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
@@ -223,6 +226,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"boot_partition": schema.Int64Attribute{
Computed: true,
},
"bus_number": schema.Int64Attribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
@@ -447,6 +453,9 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"bus_number": schema.Int64Attribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
@@ -468,12 +477,41 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"ip_address": schema.StringAttribute{
Computed: true,
},
"libvirt_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"guid": schema.StringAttribute{
Computed: true,
},
"txmode": schema.StringAttribute{
Computed: true,
},
"ioeventfd": schema.StringAttribute{
Computed: true,
},
"event_idx": schema.StringAttribute{
Computed: true,
},
"queues": schema.Int64Attribute{
Computed: true,
},
"rx_queue_size": schema.Int64Attribute{
Computed: true,
},
"tx_queue_size": schema.Int64Attribute{
Computed: true,
},
},
},
"listen_ssh": schema.BoolAttribute{
Computed: true,
},
"mac": schema.StringAttribute{
Computed: true,
},
"mtu": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
@@ -583,6 +621,10 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
},
},
},
"pci_devices": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"pinned": schema.BoolAttribute{
Computed: true,
},

View File

@@ -166,6 +166,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
"arch": schema.StringAttribute{
Computed: true,
},
"chipset": schema.StringAttribute{
Computed: true,
},
"boot_order": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
@@ -217,6 +220,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"bus_number": schema.Int64Attribute{
Computed: true,
},
"disk_id": schema.Int64Attribute{
Computed: true,
},
@@ -248,6 +254,9 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"bus_number": schema.Int64Attribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
@@ -310,6 +319,32 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
},
},
},
"libvirt_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"guid": schema.StringAttribute{
Computed: true,
},
"txmode": schema.StringAttribute{
Computed: true,
},
"ioeventfd": schema.StringAttribute{
Computed: true,
},
"event_idx": schema.StringAttribute{
Computed: true,
},
"queues": schema.Int64Attribute{
Computed: true,
},
"rx_queue_size": schema.Int64Attribute{
Computed: true,
},
"tx_queue_size": schema.Int64Attribute{
Computed: true,
},
},
},
"target": schema.StringAttribute{
Computed: true,
},

View File

@@ -158,6 +158,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
"arch": schema.StringAttribute{
Computed: true,
},
"chipset": schema.StringAttribute{
Computed: true,
},
"boot_order": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
@@ -209,6 +212,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"bus_number": schema.Int64Attribute{
Computed: true,
},
"disk_id": schema.Int64Attribute{
Computed: true,
},
@@ -240,6 +246,9 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"bus_number": schema.Int64Attribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
@@ -261,6 +270,32 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
"ip_address": schema.StringAttribute{
Computed: true,
},
"libvirt_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"guid": schema.StringAttribute{
Computed: true,
},
"txmode": schema.StringAttribute{
Computed: true,
},
"ioeventfd": schema.StringAttribute{
Computed: true,
},
"event_idx": schema.StringAttribute{
Computed: true,
},
"queues": schema.Int64Attribute{
Computed: true,
},
"rx_queue_size": schema.Int64Attribute{
Computed: true,
},
"tx_queue_size": schema.Int64Attribute{
Computed: true,
},
},
},
"listen_ssh": schema.BoolAttribute{
Computed: true,
},

View File

@@ -5,6 +5,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
"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"
@@ -30,7 +31,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
"driver": schema.StringAttribute{
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("SVA_KVM_X86", "KVM_X86", "KVM_PPC"),
stringvalidator.OneOf("SVA_KVM_X86", "KVM_X86"),
},
Description: "Hardware architecture of this compute instance.",
},
@@ -180,7 +181,7 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
"net_type": schema.StringAttribute{
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("EXTNET", "VINS", "VFNIC"),
stringvalidator.OneOf("EXTNET", "VINS", "VFNIC", "DPDK"),
},
Description: "Type of the network for this connection, either EXTNET or VINS.",
},
@@ -197,6 +198,19 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Computed: true,
Description: "MAC address associated with this connection. MAC address is assigned automatically.",
},
"weight": schema.Int64Attribute{
Optional: true,
Computed: true,
Description: "Weight the network if you need to sort network list, the smallest attach first. zero or null weight attach last",
},
"mtu": schema.Int64Attribute{
Optional: true,
Computed: true,
Validators: []validator.Int64{
int64validator.Between(1, 9216),
},
Description: "Maximum transmission unit, used only for DPDK type, must be 1-9216",
},
},
},
},
@@ -289,6 +303,8 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"enabled": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
Description: "If true - enable compute, else - disable",
},
"pause": schema.BoolAttribute{
@@ -301,6 +317,8 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"restore": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
//Default: true,
},
"auto_start": schema.BoolAttribute{
@@ -328,15 +346,21 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
"started": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
//Default: true,
Description: "Is compute started.",
},
"detach_disks": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
//Default: true,
},
"permanently": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
//Default: true,
},
"is": schema.StringAttribute{
@@ -365,6 +389,19 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
//Default: false,
Description: "Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node.",
},
"pci_devices": schema.SetAttribute{
Optional: true,
ElementType: types.Int64Type,
Description: "ID of the connected pci devices",
},
"chipset": schema.StringAttribute{
Optional: true,
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("i440fx", "Q35"),
},
Description: "Type of the emulated system, Q35 or i440fx",
},
// computed attributes
"compute_id": schema.Int64Attribute{
@@ -528,6 +565,9 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"bus_number": schema.Int64Attribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
@@ -555,6 +595,9 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
"mac": schema.StringAttribute{
Computed: true,
},
"mtu": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
@@ -590,6 +633,32 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
},
},
},
"libvirt_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"guid": schema.StringAttribute{
Computed: true,
},
"txmode": schema.StringAttribute{
Computed: true,
},
"ioeventfd": schema.StringAttribute{
Computed: true,
},
"event_idx": schema.StringAttribute{
Computed: true,
},
"queues": schema.Int64Attribute{
Computed: true,
},
"rx_queue_size": schema.Int64Attribute{
Computed: true,
},
"tx_queue_size": schema.Int64Attribute{
Computed: true,
},
},
},
"target": schema.StringAttribute{
Computed: true,
},
@@ -749,6 +818,9 @@ func MakeSchemaResourceComputeDisks() map[string]schema.Attribute {
"boot_partition": schema.Int64Attribute{
Computed: true,
},
"bus_number": schema.Int64Attribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},