This commit is contained in:
2025-02-07 11:59:43 +03:00
parent 60e23338ad
commit b8f118097e
177 changed files with 16418 additions and 214 deletions

View File

@@ -50,7 +50,9 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
AutoStartWithNode: types.BoolValue(computeRecord.AutoStart),
Chipset: types.StringValue(computeRecord.Chipset),
BootDiskSize: types.Int64Value(int64(computeRecord.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &computeRecord.BootOrder),
CdImageId: types.Int64Value(int64(computeRecord.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.Clones),
CloneReference: types.Int64Value(int64(computeRecord.CloneReference)),
ComputeCIID: types.Int64Value(int64(computeRecord.ComputeCIID)),
CPU: types.Int64Value(int64(computeRecord.CPU)),
@@ -86,11 +88,13 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
NumaNodeId: types.Int64Value(int64(computeRecord.NumaNodeId)),
OSUsers: flattenOSUsers(ctx, &computeRecord.OSUsers),
Pinned: types.BoolValue(computeRecord.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.PreferredCPU),
PCIDevices: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, flattenPCI(ctx, pciDevicesList)),
RAM: types.Int64Value(int64(computeRecord.RAM)),
ReferenceID: types.StringValue(computeRecord.ReferenceID),
Registered: types.BoolValue(computeRecord.Registered),
ResName: types.StringValue(computeRecord.ResName),
ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.ReservedNodeCpus),
RGID: types.Int64Value(int64(computeRecord.RGID)),
RGName: types.StringValue(computeRecord.RGName),
SnapSets: flattenSnapSet(ctx, &computeRecord.SnapSets),
@@ -105,27 +109,14 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
VirtualImageID: types.Int64Value(int64(computeRecord.VirtualImageID)),
VirtualImageName: types.StringValue(computeRecord.VirtualImageName),
VNCPassword: types.StringValue(computeRecord.VNCPassword),
VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.VGPUs),
}
state.BootOrder, diags = types.ListValueFrom(ctx, types.StringType, computeRecord.BootOrder)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.Clones, diags = types.ListValueFrom(ctx, types.Int64Type, computeRecord.Clones)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.Tags, diags = types.MapValueFrom(ctx, types.StringType, computeRecord.Tags)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.ReservedNodeCpus, diags = types.ListValueFrom(ctx, types.Int64Type, computeRecord.ReservedNodeCpus)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.VGPUs, diags = types.ListValueFrom(ctx, types.Int64Type, computeRecord.VGPUs)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
tflog.Info(ctx, "End FlattenDataSourceCompute")
return nil
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/models"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/utilities"
)
@@ -74,7 +75,9 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
Architecture: types.StringValue(item.Architecture),
AutoStartWithNode: types.BoolValue(item.AutoStart),
BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
CdImageId: types.Int64Value(int64(item.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
CloneReference: types.Int64Value(int64(item.CloneReference)),
Chipset: types.StringValue(item.Chipset),
ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
@@ -105,10 +108,12 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
NumaAffinity: types.StringValue(item.NumaAffinity),
NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
Pinned: types.BoolValue(item.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
RAM: types.Int64Value(int64(item.RAM)),
ReferenceID: types.StringValue(item.ReferenceID),
Registered: types.BoolValue(item.Registered),
ResName: types.StringValue(item.ResName),
ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
RGID: types.Int64Value(int64(item.RGID)),
RGName: types.StringValue(item.RGName),
SnapSets: flattenSnapSetInList(ctx, &item.SnapSets),
@@ -122,28 +127,13 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
UserManaged: types.BoolValue(item.UserManaged),
VINSConnected: types.Int64Value(int64(item.VINSConnected)),
VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
}
temp.BootOrder, diags = types.ListValueFrom(ctx, types.StringType, item.BootOrder)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.Clones, diags = types.ListValueFrom(ctx, types.Int64Type, item.Clones)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.Tags, diags = types.MapValueFrom(ctx, types.StringType, item.Tags)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.ReservedNodeCpus, diags = types.ListValueFrom(ctx, types.Int64Type, item.ReservedNodeCpus)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.VGPUs, diags = types.ListValueFrom(ctx, types.Int64Type, item.VGPUs)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
res = append(res, temp)
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/models"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/utilities"
)
@@ -72,7 +73,9 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
Architecture: types.StringValue(item.Architecture),
AutoStartWithNode: types.BoolValue(item.AutoStart),
BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
CdImageId: types.Int64Value(int64(item.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
Chipset: types.StringValue(item.Chipset),
CloneReference: types.Int64Value(int64(item.CloneReference)),
ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
@@ -103,10 +106,12 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
NumaAffinity: types.StringValue(item.NumaAffinity),
NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
Pinned: types.BoolValue(item.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
RAM: types.Int64Value(int64(item.RAM)),
ReferenceID: types.StringValue(item.ReferenceID),
Registered: types.BoolValue(item.Registered),
ResName: types.StringValue(item.ResName),
ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
RGID: types.Int64Value(int64(item.RGID)),
RGName: types.StringValue(item.RGName),
SnapSets: flattenSnapSetInListDeleted(ctx, &item.SnapSets),
@@ -120,28 +125,13 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
UserManaged: types.BoolValue(item.UserManaged),
VINSConnected: types.Int64Value(int64(item.VINSConnected)),
VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
}
temp.BootOrder, diags = types.ListValueFrom(ctx, types.StringType, item.BootOrder)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
temp.Clones, diags = types.ListValueFrom(ctx, types.Int64Type, item.Clones)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
temp.Tags, diags = types.MapValueFrom(ctx, types.StringType, item.Tags)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
temp.ReservedNodeCpus, diags = types.ListValueFrom(ctx, types.Int64Type, item.ReservedNodeCpus)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.VGPUs, diags = types.ListValueFrom(ctx, types.Int64Type, item.VGPUs)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
res = append(res, temp)
}

View File

@@ -121,6 +121,7 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
NumaNodeId: types.Int64Value(int64(recordItemCompute.NumaNodeId)),
OSUsers: flattenResourceOSUsers(ctx, &recordItemCompute.OSUsers),
Pinned: types.BoolValue(recordItemCompute.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordItemCompute.PreferredCPU),
ReferenceID: types.StringValue(recordItemCompute.ReferenceID),
Registered: types.BoolValue(recordItemCompute.Registered),
ResName: types.StringValue(recordItemCompute.ResName),

View File

@@ -61,6 +61,7 @@ type RecordComputeModel struct {
OSUsers []ItemOSUserModel `tfsdk:"os_users"`
PCIDevices types.List `tfsdk:"pci_devices"`
Pinned types.Bool `tfsdk:"pinned"`
PreferredCPU types.List `tfsdk:"preferred_cpu"`
RAM types.Int64 `tfsdk:"ram"`
ReferenceID types.String `tfsdk:"reference_id"`
Registered types.Bool `tfsdk:"registered"`

View File

@@ -73,6 +73,7 @@ type ItemComputeModel struct {
NumaAffinity types.String `tfsdk:"numa_affinity"`
NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
Pinned types.Bool `tfsdk:"pinned"`
PreferredCPU types.List `tfsdk:"preferred_cpu"`
RAM types.Int64 `tfsdk:"ram"`
ReferenceID types.String `tfsdk:"reference_id"`
Registered types.Bool `tfsdk:"registered"`

View File

@@ -71,6 +71,7 @@ type ItemListDeletedComputeModel struct {
NumaAffinity types.String `tfsdk:"numa_affinity"`
NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
Pinned types.Bool `tfsdk:"pinned"`
PreferredCPU types.List `tfsdk:"preferred_cpu"`
RAM types.Int64 `tfsdk:"ram"`
ReferenceID types.String `tfsdk:"reference_id"`
Registered types.Bool `tfsdk:"registered"`

View File

@@ -38,6 +38,7 @@ type ResourceComputeModel struct {
Rollback types.Object `tfsdk:"rollback"`
CD types.Object `tfsdk:"cd"`
PinToStack types.Bool `tfsdk:"pin_to_stack"`
PreferredCPU types.List `tfsdk:"preferred_cpu"`
Description types.String `tfsdk:"description"`
CloudInit types.String `tfsdk:"cloud_init"`
Enabled types.Bool `tfsdk:"enabled"`

View File

@@ -94,6 +94,11 @@ func (r *resourceCompute) Create(ctx context.Context, req resource.CreateRequest
// because additional settings failure is not critical. If errors were added instead of warnings, terraform
// framework would mark resource as tainted and delete it, which would be unwanted behaviour.
// pin to stack if needed, warnings added to resp.Diagnostics in case of failure.
if plan.PinToStack.ValueBool() {
resp.Diagnostics.Append(utilities.ComputeResourcePinToStack(ctx, &plan, r.client)...)
}
// enable or disable Compute, warnings added to resp.Diagnostics in case of failure.
resp.Diagnostics.Append(utilities.ComputeResourceEnableDisable(ctx, &plan, r.client)...)
@@ -146,11 +151,6 @@ func (r *resourceCompute) Create(ctx context.Context, req resource.CreateRequest
resp.Diagnostics.Append(utilities.ComputeResourcePCIDevice(ctx, &plan, r.client)...)
}
// pin to stack if needed, warnings added to resp.Diagnostics in case of failure.
if plan.PinToStack.ValueBool() {
resp.Diagnostics.Append(utilities.ComputeResourcePinToStack(ctx, &plan, r.client)...)
}
// set auto start_w_node if pin_to_stack == false
if !plan.PinToStack.ValueBool() && plan.AutoStartWithNode.ValueBool() {
resp.Diagnostics.Append(utilities.ComputeResourceAutoStartWithNode(ctx, &plan, r.client)...)
@@ -319,15 +319,6 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
}
// Network(s) update if needed
if !plan.Network.Equal(state.Network) && !plan.Network.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceNetworkUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update network(s)")
return
}
}
// PCI device(s) update if needed
if !plan.PCIDevices.Equal(state.PCIDevices) {
resp.Diagnostics.Append(utilities.ComputeResourcePCIDeviceUpdate(ctx, &state, &plan, r.client)...)
@@ -337,10 +328,19 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
}
// pin to stack if needed
if !plan.PinToStack.Equal(state.PinToStack) {
resp.Diagnostics.Append(utilities.ComputeResourcePinToStackUpdate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error pin/unpin to stack compute")
return
}
}
// Compute parameters update if needed
if (!plan.Description.IsUnknown() && !plan.Description.Equal(state.Description)) || !plan.Name.Equal(state.Name) ||
!plan.NumaAffinity.Equal(state.NumaAffinity) || !plan.CPUPin.Equal(state.CPUPin) || !plan.HPBacked.Equal(state.HPBacked) || (!plan.Chipset.IsUnknown() && !plan.Chipset.Equal(state.Chipset)) ||
!plan.AutoStartWithNode.Equal(state.AutoStartWithNode) {
!plan.AutoStartWithNode.Equal(state.AutoStartWithNode) || (!plan.PreferredCPU.IsUnknown() && !plan.PreferredCPU.Equal(state.Description)) {
resp.Diagnostics.Append(utilities.ComputeResourceComputeUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update compute parameters")
@@ -348,6 +348,15 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
}
// Network(s) update if needed
if !plan.Network.Equal(state.Network) && !plan.Network.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceNetworkUpdate(ctx, &state, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error update network(s)")
return
}
}
// Affinity label update if needed
if !plan.AffinityLabel.Equal(state.AffinityLabel) && !plan.AffinityLabel.IsUnknown() {
resp.Diagnostics.Append(utilities.ComputeResourceAffinityLabelUpdate(ctx, &plan, r.client)...)
@@ -429,15 +438,6 @@ func (r *resourceCompute) Update(ctx context.Context, req resource.UpdateRequest
}
}
// pin to stack if needed
if !plan.PinToStack.Equal(state.PinToStack) {
resp.Diagnostics.Append(utilities.ComputeResourcePinToStackUpdate(ctx, &plan, r.client)...)
if resp.Diagnostics.HasError() {
tflog.Error(ctx, "Update resourceCompute: Error pin/unpin to stack compute")
return
}
}
// compute pause if need
if !plan.Pause.Equal(state.Pause) && !plan.Pause.IsNull() {
resp.Diagnostics.Append(utilities.ComputeResourcePauseResumeCompute(ctx, &plan, r.client)...)

View File

@@ -631,6 +631,10 @@ func MakeSchemaDataSourceCompute() map[string]schema.Attribute {
"pinned": schema.BoolAttribute{
Computed: true,
},
"preferred_cpu": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"ram": schema.Int64Attribute{
Computed: true,
},

View File

@@ -391,6 +391,10 @@ func MakeSchemaDataSourceComputeList() map[string]schema.Attribute {
"pinned": schema.BoolAttribute{
Computed: true,
},
"preferred_cpu": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"ram": schema.Int64Attribute{
Computed: true,
},

View File

@@ -383,6 +383,10 @@ func MakeSchemaDataSourceComputeListDeleted() map[string]schema.Attribute {
"pinned": schema.BoolAttribute{
Computed: true,
},
"preferred_cpu": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"ram": schema.Int64Attribute{
Computed: true,
},

View File

@@ -390,6 +390,12 @@ func MakeSchemaResourceCompute() map[string]schema.Attribute {
Default: booldefault.StaticBool(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.",
},
"preferred_cpu": schema.ListAttribute{
Optional: true,
Computed: true,
ElementType: types.Int64Type,
Description: "Recommended isolated CPUs. Field is ignored if compute.cpupin=False or compute.pinned=False",
},
"pci_devices": schema.SetAttribute{
Optional: true,
ElementType: types.Int64Type,

View File

@@ -191,6 +191,15 @@ func CreateResourceCompute(ctx context.Context, plan *models.ResourceComputeMode
createReqX86.HPBacked = true
}
if !plan.PreferredCPU.IsUnknown() {
preferredCPUList := plan.PreferredCPU.Elements()
preferredCPU := make([]int64, 0, len(preferredCPUList))
for _, elem := range preferredCPUList {
preferredCPU = append(preferredCPU, elem.(types.Int64).ValueInt64())
}
createReqX86.PreferredCPU = preferredCPU
}
tflog.Info(ctx, fmt.Sprintf("CreateResourceCompute: creating Compute of type KVM VM x86"))
id, err := c.CloudAPI().KVMX86().Create(ctx, createReqX86)
if err != nil {

View File

@@ -47,6 +47,20 @@ func ComputeResourceResize(ctx context.Context, state *models.ResourceComputeMod
resizeReq.CPU = uint64(plan.CPU.ValueInt64())
}
if resizeReq.CPU != 0 {
if !plan.PreferredCPU.IsUnknown() {
preferredCPUList := plan.PreferredCPU.Elements()
preferredCPU := make([]int64, 0, len(preferredCPUList))
for _, elem := range preferredCPUList {
preferredCPU = append(preferredCPU, elem.(types.Int64).ValueInt64())
}
resizeReq.PreferredCPU = preferredCPU
}
if len(state.PreferredCPU.Elements()) != 0 && len(resizeReq.PreferredCPU) == 0 {
resizeReq.PreferredCPU = []int64{-1}
}
}
if !plan.RAM.Equal(state.RAM) {
resizeReq.RAM = uint64(plan.RAM.ValueInt64())
}
@@ -288,7 +302,7 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
needStart := false
// need stop to attach first network
if len(detachMap) == len(state.Network.Elements()) || (len(state.Network.Elements()) < 1) && len(attachMap) > 0 || hasDPDKnetwork(attachMap) {
if len(detachMap) == len(state.Network.Elements()) || (len(state.Network.Elements()) < 1) && len(attachMap) > 0 {
tflog.Info(ctx, "ComputeResourceNetworkUpdate: stop compute", map[string]any{"compute_id": computeId})
_, err = c.CloudAPI().Compute().Stop(ctx, compute.StopRequest{ComputeID: computeId})
if err != nil {
@@ -336,6 +350,10 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
}
}
if diags.HasError() {
return diags
}
if needStart {
diags = ComputeResourceStartStop(ctx, plan, c)
}
@@ -349,15 +367,6 @@ func ComputeResourceNetworkUpdate(ctx context.Context, state *models.ResourceCom
return nil
}
func hasDPDKnetwork(networkAttachMap []map[string]attr.Value) bool {
for _, elem := range networkAttachMap {
if elem["net_type"].(types.String).ValueString() == "DPDK" {
return true
}
}
return false
}
func ComputeResourceComputeUpdate(ctx context.Context, state *models.ResourceComputeModel, plan *models.ResourceComputeModel, c *client.Client) diag.Diagnostics {
tflog.Info(ctx, "ComputeResourceComputeUpdate: start update compute parameters", map[string]any{"compute_id": plan.ID.ValueString()})
diags := diag.Diagnostics{}
@@ -392,11 +401,23 @@ func ComputeResourceComputeUpdate(ctx context.Context, state *models.ResourceCom
req.Chipset = plan.Chipset.ValueString()
}
if !plan.PreferredCPU.IsUnknown() {
preferredCPUList := plan.PreferredCPU.Elements()
preferredCPU := make([]int64, 0, len(preferredCPUList))
for _, elem := range preferredCPUList {
preferredCPU = append(preferredCPU, elem.(types.Int64).ValueInt64())
}
req.PreferredCPU = preferredCPU
}
if len(state.PreferredCPU.Elements()) != 0 && len(req.PreferredCPU) == 0 {
req.PreferredCPU = []int64{-1}
}
// Note bene: numa_affinity, cpu_pin and hp_backed are not allowed to be changed for compute in STARTED tech status.
// If STARTED, we need to stop it before update
var isStopRequred bool
if !plan.NumaAffinity.Equal(state.NumaAffinity) || !plan.CPUPin.Equal(state.CPUPin) || !plan.HPBacked.Equal(state.HPBacked) || !plan.Chipset.Equal(state.Chipset) {
if !plan.NumaAffinity.Equal(state.NumaAffinity) || !plan.CPUPin.Equal(state.CPUPin) || !plan.HPBacked.Equal(state.HPBacked) || !plan.Chipset.Equal(state.Chipset) || (len(req.PreferredCPU) != 0) {
isStopRequred = true
tflog.Info(ctx, "ComputeResourceComputeUpdate: stop compute", map[string]any{"compute_id": computeId})
_, err = c.CloudAPI().Compute().Stop(ctx, compute.StopRequest{ComputeID: computeId})

View File

@@ -2,6 +2,7 @@ package flattens
import (
"context"
"fmt"
"strconv"
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -35,19 +36,25 @@ func NodeDataSource(ctx context.Context, state *models.DataSourceNode, c *client
Consumption: flattenConsumpion(ctx, &recordNode.Consumption),
CpuInfo: flattenCpuInfo(ctx, &recordNode.CpuInfo),
CPUAllocationRatio: types.Int64Value(int64(recordNode.CPUAllocationRatio)),
DPDK: flattenDPDK(ctx, &recordNode.DPDK),
GID: types.Int64Value(int64(recordNode.GID)),
ID: types.StringValue(strconv.Itoa(int(recordNode.ID))),
IPAddr: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.IPAddr),
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.IsolatedCpus),
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &recordNode.IsolatedCpus),
Name: types.StringValue(recordNode.Name),
NeedReboot: types.BoolValue(recordNode.NeedReboot),
NetworkMode: types.StringValue(recordNode.NetworkMode),
NicInfo: flattenNicInfo(ctx, recordNode.NicInfo),
NumaTopology: flattenNumaTopology(ctx, &recordNode.NumaTopology),
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.ReservedCPUs),
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &recordNode.ReservedCPUs),
Roles: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.Roles),
SriovEnabled: types.BoolValue(recordNode.SriovEnabled),
StackId: types.Int64Value(int64(recordNode.StackID)),
Status: types.StringValue(recordNode.Status),
ToActive: flattenRole(ctx, &recordNode.ToActive),
ToInstalling: flattenRole(ctx, &recordNode.ToInstalling),
ToMaintenance: flattenRole(ctx, &recordNode.ToMaintenance),
ToRestricted: flattenRole(ctx, &recordNode.ToRestricted),
Version: types.StringValue(recordNode.Version),
}
@@ -125,7 +132,7 @@ func flattenVFList(ctx context.Context, vfMap []interface{}) []models.VFList {
for _, item := range vfMap {
itemMap := item.(map[string]interface{})
vf := models.VFList{
FnID: types.Int64Value(itemMap["fnId"].(int64)),
FnID: types.Int64Value(int64(itemMap["fnId"].(float64))),
PCISlot: types.StringValue(itemMap["pciSlot"].(string)),
}
vfList = append(vfList, vf)
@@ -167,3 +174,37 @@ func flattenNumaTopologyNodes(ctx context.Context, nodes map[string]node.NodeInf
tflog.Info(ctx, "End flattenNumaTopologyNodes")
return res
}
func flattenDPDK(ctx context.Context, dpdk *node.DPDK) *models.DPDKModel {
tflog.Info(ctx, "Start flattenDPDK")
hpMemory, diags := types.MapValueFrom(ctx, types.Int64Type, dpdk.HPMemory)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDPDK", diags))
}
res := models.DPDKModel{
Bridges: &models.Bridges{
Backplane1: &models.Backplane1{
Interfaces: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &dpdk.Bridges.Backplane1.Interfaces),
NumaNode: types.Int64Value(int64(dpdk.Bridges.Backplane1.NumaNode)),
},
},
HPMemory: hpMemory,
PMDCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &dpdk.PMDCPU),
}
tflog.Info(ctx, "End flattenDPDK")
return &res
}
func flattenRole(ctx context.Context, role *node.Role) *models.Role {
tflog.Info(ctx, "Start flattenRole")
res := models.Role{
Actor: types.StringValue(role.Actor),
Reason: types.StringValue(role.Reason),
Time: types.Int64Value(int64(role.Time)),
}
tflog.Info(ctx, "End flattenRole")
return &res
}

View File

@@ -57,44 +57,46 @@ func flattenItemsList(ctx context.Context, recordList *node.ListNodes) []models.
for _, item := range recordList.Data {
temp := models.ItemNodeModel{
AdditionalPkgs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.AdditionalPkgs),
CpuInfo: flattenCpuInfo(ctx, &item.CpuInfo),
Description: types.StringValue(item.Description),
GID: types.Int64Value(int64(item.GID)),
GUID: types.StringValue(item.GUID),
HostKey: types.StringValue(item.HostKey),
IPAddr: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.IPAddr),
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.IsolatedCpus),
LastCheck: types.Int64Value(int64(item.LastCheck)),
MachineGUID: types.StringValue(item.MachineGUID),
MainboardSN: types.StringValue(item.MainboardSN),
Memory: types.Int64Value(int64(item.Memory)),
Milestones: types.Int64Value(int64(item.Milestones)),
Model: types.StringValue(item.Model),
Name: types.StringValue(item.Name),
NeedReboot: types.BoolValue(item.NeedReboot),
NetAddr: flattenNetAddr(ctx, item.NetAddr),
NetworkMode: types.StringValue(item.NetworkMode),
NicInfo: flattenNicInfo(ctx, item.NicInfo),
NodeUUID: types.StringValue(item.NodeUUID),
NodeID: types.Int64Value(int64(item.ID)),
NumaTopology: flattenNumaTopology(ctx, &item.NumaTopology),
PeerBackup: types.Int64Value(int64(item.PeerBackup)),
PeerLog: types.Int64Value(int64(item.PeerLog)),
PeerStats: types.Int64Value(int64(item.PeerStats)),
Pgpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Pgpus),
PublicKeys: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.PublicKeys),
Release: types.StringValue(item.Release),
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.ReservedCPUs),
Roles: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Roles),
SEPs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Seps),
SerialNum: types.StringValue(item.SerialNum),
SriovEnabled: types.BoolValue(item.SriovEnabled),
StackId: types.Int64Value(int64(item.StackID)),
Status: types.StringValue(item.Status),
Tags: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Tags),
Type: types.StringValue(item.Type),
Version: types.StringValue(item.Version),
AdditionalPkgs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.AdditionalPkgs),
CpuInfo: flattenCpuInfo(ctx, &item.CpuInfo),
Description: types.StringValue(item.Description),
DPDK: flattenDPDK(ctx, &item.DPDK),
GID: types.Int64Value(int64(item.GID)),
GUID: types.StringValue(item.GUID),
HostKey: types.StringValue(item.HostKey),
IPAddr: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.IPAddr),
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.IsolatedCpus),
LastCheck: types.Int64Value(int64(item.LastCheck)),
MachineGUID: types.StringValue(item.MachineGUID),
MainboardSN: types.StringValue(item.MainboardSN),
Memory: types.Int64Value(int64(item.Memory)),
Milestones: types.Int64Value(int64(item.Milestones)),
Model: types.StringValue(item.Model),
Name: types.StringValue(item.Name),
NeedReboot: types.BoolValue(item.NeedReboot),
NetAddr: flattenNetAddr(ctx, item.NetAddr),
NetworkMode: types.StringValue(item.NetworkMode),
NicInfo: flattenNicInfo(ctx, item.NicInfo),
NodeUUID: types.StringValue(item.NodeUUID),
NodeID: types.Int64Value(int64(item.ID)),
NumaTopology: flattenNumaTopology(ctx, &item.NumaTopology),
PeerBackup: types.Int64Value(int64(item.PeerBackup)),
PeerLog: types.Int64Value(int64(item.PeerLog)),
PeerStats: types.Int64Value(int64(item.PeerStats)),
Pgpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Pgpus),
PublicKeys: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.PublicKeys),
Release: types.StringValue(item.Release),
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedCPUs),
Roles: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Roles),
SEPs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Seps),
SerialNum: types.StringValue(item.SerialNum),
SriovEnabled: types.BoolValue(item.SriovEnabled),
StackId: types.Int64Value(int64(item.StackID)),
Status: types.StringValue(item.Status),
Tags: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Tags),
Type: types.StringValue(item.Type),
UEFIFirmwareFile: types.StringValue(item.UEFIFirmwareFile),
Version: types.StringValue(item.Version),
}
res = append(res, temp)
}

View File

@@ -14,12 +14,14 @@ type DataSourceNode struct {
Consumption *ConsumptionModel `tfsdk:"consumption"`
CpuInfo *CpuInfoModel `tfsdk:"cpu_info"`
CPUAllocationRatio types.Int64 `tfsdk:"cpu_allocation_ratio"`
DPDK *DPDKModel `tfsdk:"dpdk"`
GID types.Int64 `tfsdk:"gid"`
ID types.String `tfsdk:"id"`
IPAddr types.List `tfsdk:"ipaddr"`
IsolatedCPUs types.List `tfsdk:"isolated_cpus"`
Name types.String `tfsdk:"name"`
NeedReboot types.Bool `tfsdk:"need_reboot"`
NetworkMode types.String `tfsdk:"network_mode"`
NicInfo []NicInfoModel `tfsdk:"nic_info"`
NumaTopology *NumaTopologyModel `tfsdk:"numa_topology"`
ReservedCPUs types.List `tfsdk:"reserved_cpus"`
@@ -27,6 +29,10 @@ type DataSourceNode struct {
SriovEnabled types.Bool `tfsdk:"sriov_enabled"`
StackId types.Int64 `tfsdk:"stack_id"`
Status types.String `tfsdk:"status"`
ToActive *Role `tfsdk:"to_active"`
ToInstalling *Role `tfsdk:"to_installing"`
ToMaintenance *Role `tfsdk:"to_maintenance"`
ToRestricted *Role `tfsdk:"to_restricted"`
Version types.String `tfsdk:"version"`
}
@@ -85,3 +91,24 @@ type NumaTopologyNodesMemory struct {
TwoM types.Int64 `tfsdk:"two_m"`
Total types.Int64 `tfsdk:"total"`
}
type DPDKModel struct {
Bridges *Bridges `tfsdk:"bridges"`
HPMemory types.Map `tfsdk:"hp_memory"`
PMDCPU types.List `tfsdk:"pmd_cpu"`
}
type Bridges struct {
Backplane1 *Backplane1 `tfsdk:"backplane1"`
}
type Backplane1 struct {
Interfaces types.List `tfsdk:"interfaces"`
NumaNode types.Int64 `tfsdk:"numa_node"`
}
type Role struct {
Actor types.String `tfsdk:"actor"`
Reason types.String `tfsdk:"reason"`
Time types.Int64 `tfsdk:"time"`
}

View File

@@ -25,44 +25,46 @@ type DataSourceNodeList struct {
}
type ItemNodeModel struct {
AdditionalPkgs types.List `tfsdk:"additional_pkgs"`
CpuInfo *CpuInfoModel `tfsdk:"cpu_info"`
Description types.String `tfsdk:"description"`
GID types.Int64 `tfsdk:"gid"`
GUID types.String `tfsdk:"guid"`
HostKey types.String `tfsdk:"hostkey"`
IPAddr types.List `tfsdk:"ipaddr"`
IsolatedCPUs types.List `tfsdk:"isolated_cpus"`
LastCheck types.Int64 `tfsdk:"lastcheck"`
MachineGUID types.String `tfsdk:"machine_guid"`
MainboardSN types.String `tfsdk:"mainboard_sn"`
Memory types.Int64 `tfsdk:"memory"`
Milestones types.Int64 `tfsdk:"milestones"`
Model types.String `tfsdk:"model"`
Name types.String `tfsdk:"name"`
NeedReboot types.Bool `tfsdk:"need_reboot"`
NetAddr []NetAddrModel `tfsdk:"net_addr"`
NetworkMode types.String `tfsdk:"network_mode"`
NicInfo []NicInfoModel `tfsdk:"nic_info"`
NodeUUID types.String `tfsdk:"node_uuid"`
NodeID types.Int64 `tfsdk:"node_id"`
NumaTopology *NumaTopologyModel `tfsdk:"numa_topology"`
PeerBackup types.Int64 `tfsdk:"peer_backup"`
PeerLog types.Int64 `tfsdk:"peer_log"`
PeerStats types.Int64 `tfsdk:"peer_stats"`
Pgpus types.List `tfsdk:"pgpus"`
PublicKeys types.List `tfsdk:"public_keys"`
Release types.String `tfsdk:"release"`
ReservedCPUs types.List `tfsdk:"reserved_cpus"`
Roles types.List `tfsdk:"roles"`
SEPs types.List `tfsdk:"seps"`
SerialNum types.String `tfsdk:"serial_num"`
SriovEnabled types.Bool `tfsdk:"sriov_enabled"`
StackId types.Int64 `tfsdk:"stack_id"`
Status types.String `tfsdk:"status"`
Tags types.List `tfsdk:"tags"`
Type types.String `tfsdk:"type"`
Version types.String `tfsdk:"version"`
AdditionalPkgs types.List `tfsdk:"additional_pkgs"`
CpuInfo *CpuInfoModel `tfsdk:"cpu_info"`
Description types.String `tfsdk:"description"`
DPDK *DPDKModel `tfsdk:"dpdk"`
GID types.Int64 `tfsdk:"gid"`
GUID types.String `tfsdk:"guid"`
HostKey types.String `tfsdk:"hostkey"`
IPAddr types.List `tfsdk:"ipaddr"`
IsolatedCPUs types.List `tfsdk:"isolated_cpus"`
LastCheck types.Int64 `tfsdk:"lastcheck"`
MachineGUID types.String `tfsdk:"machine_guid"`
MainboardSN types.String `tfsdk:"mainboard_sn"`
Memory types.Int64 `tfsdk:"memory"`
Milestones types.Int64 `tfsdk:"milestones"`
Model types.String `tfsdk:"model"`
Name types.String `tfsdk:"name"`
NeedReboot types.Bool `tfsdk:"need_reboot"`
NetAddr []NetAddrModel `tfsdk:"net_addr"`
NetworkMode types.String `tfsdk:"network_mode"`
NicInfo []NicInfoModel `tfsdk:"nic_info"`
NodeUUID types.String `tfsdk:"node_uuid"`
NodeID types.Int64 `tfsdk:"node_id"`
NumaTopology *NumaTopologyModel `tfsdk:"numa_topology"`
PeerBackup types.Int64 `tfsdk:"peer_backup"`
PeerLog types.Int64 `tfsdk:"peer_log"`
PeerStats types.Int64 `tfsdk:"peer_stats"`
Pgpus types.List `tfsdk:"pgpus"`
PublicKeys types.List `tfsdk:"public_keys"`
Release types.String `tfsdk:"release"`
ReservedCPUs types.List `tfsdk:"reserved_cpus"`
Roles types.List `tfsdk:"roles"`
SEPs types.List `tfsdk:"seps"`
SerialNum types.String `tfsdk:"serial_num"`
SriovEnabled types.Bool `tfsdk:"sriov_enabled"`
StackId types.Int64 `tfsdk:"stack_id"`
Status types.String `tfsdk:"status"`
Tags types.List `tfsdk:"tags"`
Type types.String `tfsdk:"type"`
UEFIFirmwareFile types.String `tfsdk:"uefi_firmware_file"`
Version types.String `tfsdk:"version"`
}
type NetAddrModel struct {

View File

@@ -76,6 +76,36 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
"cpu_allocation_ratio": schema.Int64Attribute{
Computed: true,
},
"dpdk": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"bridges": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backplane1": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"interfaces": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"numa_node": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
"hp_memory": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"pmd_cpu": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
},
},
"gid": schema.Int64Attribute{
Computed: true,
},
@@ -88,7 +118,7 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
},
"isolated_cpus": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
ElementType: types.Int64Type,
},
"name": schema.StringAttribute{
Computed: true,
@@ -96,6 +126,9 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
"need_reboot": schema.BoolAttribute{
Computed: true,
},
"network_mode": schema.StringAttribute{
Computed: true,
},
"nic_info": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
@@ -169,7 +202,7 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
},
"reserved_cpus": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
ElementType: types.Int64Type,
},
"roles": schema.ListAttribute{
Computed: true,
@@ -184,6 +217,62 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
"status": schema.StringAttribute{
Computed: true,
},
"to_active": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"actor": schema.StringAttribute{
Computed: true,
},
"reason": schema.StringAttribute{
Computed: true,
},
"time": schema.Int64Attribute{
Computed: true,
},
},
},
"to_installing": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"actor": schema.StringAttribute{
Computed: true,
},
"reason": schema.StringAttribute{
Computed: true,
},
"time": schema.Int64Attribute{
Computed: true,
},
},
},
"to_maintenance": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"actor": schema.StringAttribute{
Computed: true,
},
"reason": schema.StringAttribute{
Computed: true,
},
"time": schema.Int64Attribute{
Computed: true,
},
},
},
"to_restricted": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"actor": schema.StringAttribute{
Computed: true,
},
"reason": schema.StringAttribute{
Computed: true,
},
"time": schema.Int64Attribute{
Computed: true,
},
},
},
"version": schema.StringAttribute{
Computed: true,
},

View File

@@ -75,6 +75,36 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
"description": schema.StringAttribute{
Computed: true,
},
"dpdk": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"bridges": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backplane1": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"interfaces": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"numa_node": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
"hp_memory": schema.MapAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"pmd_cpu": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
},
},
"gid": schema.Int64Attribute{
Computed: true,
},
@@ -93,7 +123,7 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
},
"isolated_cpus": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
ElementType: types.Int64Type,
},
"lastcheck": schema.Int64Attribute{
Computed: true,
@@ -245,7 +275,7 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
},
"reserved_cpus": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
ElementType: types.Int64Type,
},
"roles": schema.ListAttribute{
Computed: true,
@@ -274,6 +304,9 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
"type": schema.StringAttribute{
Computed: true,
},
"uefi_firmware_file": schema.StringAttribute{
Computed: true,
},
"version": schema.StringAttribute{
Computed: true,
},

View File

@@ -337,10 +337,11 @@ func flattenReservations(ctx context.Context, items *vins.ListReservations) type
tempSlice := make([]types.Object, 0, len(*items))
for _, item := range *items {
temp := models.ReservationModel{
IP: types.StringValue(item.IP),
MAC: types.StringValue(item.MAC),
Type: types.StringValue(item.Type),
VMID: types.Int64Value(int64(item.VMID)),
AccountID: types.Int64Value(int64(item.AccountID)),
IP: types.StringValue(item.IP),
MAC: types.StringValue(item.MAC),
Type: types.StringValue(item.Type),
VMID: types.Int64Value(int64(item.VMID)),
}
obj, diags := types.ObjectValueFrom(ctx, models.ItemReservations, temp)

View File

@@ -175,10 +175,11 @@ type RecordDHCPConfigModel struct {
}
type ReservationModel struct {
IP types.String `tfsdk:"ip"`
MAC types.String `tfsdk:"mac"`
Type types.String `tfsdk:"type"`
VMID types.Int64 `tfsdk:"vm_id"`
AccountID types.Int64 `tfsdk:"account_id""`
IP types.String `tfsdk:"ip"`
MAC types.String `tfsdk:"mac"`
Type types.String `tfsdk:"type"`
VMID types.Int64 `tfsdk:"vm_id"`
}
type RecordNATModel struct {
@@ -375,10 +376,11 @@ var ItemDHCPConfig = map[string]attr.Type{
}
var ItemReservations = map[string]attr.Type{
"ip": types.StringType,
"mac": types.StringType,
"type": types.StringType,
"vm_id": types.Int64Type,
"account_id": types.Int64Type,
"ip": types.StringType,
"mac": types.StringType,
"type": types.StringType,
"vm_id": types.Int64Type,
}
var ItemGW = map[string]attr.Type{

View File

@@ -333,6 +333,9 @@ func MakeSchemaDataSourceVINS() map[string]schema.Attribute {
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"account_id": schema.Int64Attribute{
Computed: true,
},
"ip": schema.StringAttribute{
Computed: true,
},