1.3.0
This commit is contained in:
@@ -76,7 +76,7 @@ func DiskDataSource(ctx context.Context, state *models.DiskModel, c *client.Clie
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
state.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
state.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.Images to state.Images", diags))
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func DiskListDataSource(ctx context.Context, state *models.DisksModel, c *client
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.Images to d.Images", diags))
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.ListDisksModel
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func DiskListUnattachedDataSource(ctx context.Context, state *models.DataSourceD
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListUnattachedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func DiskReplicationDataSource(ctx context.Context, state *models.RecordDiskMode
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
GUID: types.Int64Value(int64(recordDisk.GUID)),
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
|
||||
Name: types.StringValue(recordDisk.Name),
|
||||
IQN: types.StringValue(recordDisk.IQN),
|
||||
Login: types.StringValue(recordDisk.Login),
|
||||
|
||||
@@ -86,7 +86,7 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
plan.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
plan.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.Images to plan.Images", diags))
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
|
||||
GUID: types.Int64Value(int64(recordDisk.GUID)),
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
|
||||
IQN: types.StringValue(recordDisk.IQN),
|
||||
Login: types.StringValue(recordDisk.Login),
|
||||
Milestones: types.Int64Value(int64(recordDisk.Milestones)),
|
||||
|
||||
@@ -64,7 +64,7 @@ func MakeSchemaDataSourceDisk() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"iotune": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -98,7 +98,7 @@ func MakeSchemaDataSourceDiskList() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"iotune": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -98,7 +98,7 @@ func MakeSchemaDataSourceDiskListDeleted() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"iotune": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -109,7 +109,7 @@ func MakeSchemaDataSourceDiskListUnattached() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"iotune": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -71,7 +71,7 @@ func MakeSchemaDataSourceDiskReplication() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"iotune": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -204,7 +204,7 @@ func MakeSchemaResourceDisk() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"last_updated": schema.StringAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -107,7 +107,7 @@ func MakeSchemaResourceDiskReplication() map[string]schema.Attribute {
|
||||
},
|
||||
"images": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"iotune": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
|
||||
@@ -45,14 +45,14 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
|
||||
AccountID: uint64(plan.AccountID.ValueInt64()),
|
||||
Name: plan.DiskName.ValueString(),
|
||||
Size: uint64(plan.SizeMax.ValueInt64()),
|
||||
GID: uint64(plan.GID.ValueInt64()),
|
||||
//GID: uint64(plan.GID.ValueInt64()),
|
||||
}
|
||||
|
||||
if plan.Type.IsUnknown() {
|
||||
createReq.Type = "D" // default value
|
||||
} else {
|
||||
createReq.Type = plan.Type.ValueString()
|
||||
}
|
||||
//if plan.Type.IsUnknown() {
|
||||
// createReq.Type = "D" // default value
|
||||
//} else {
|
||||
// createReq.Type = plan.Type.ValueString()
|
||||
//}
|
||||
if !plan.SEPID.IsUnknown() {
|
||||
createReq.SEPID = uint64(plan.SEPID.ValueInt64())
|
||||
}
|
||||
@@ -62,9 +62,9 @@ func CreateRequestResourceDisk(ctx context.Context, plan *models.ResourceDiskMod
|
||||
if !plan.Description.IsUnknown() {
|
||||
createReq.Description = plan.Description.ValueString()
|
||||
}
|
||||
if !plan.SSDSize.IsUnknown() {
|
||||
createReq.SSDSize = uint64(plan.SSDSize.ValueInt64())
|
||||
}
|
||||
//if !plan.SSDSize.IsUnknown() {
|
||||
// createReq.SSDSize = uint64(plan.SSDSize.ValueInt64())
|
||||
//}
|
||||
|
||||
return createReq
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ func RGDataSource(ctx context.Context, state *models.DataSourceRGModel, c *clien
|
||||
LockStatus: types.StringValue(recordRG.LockStatus),
|
||||
Milestones: types.Int64Value(int64(recordRG.Milestones)),
|
||||
Name: types.StringValue(recordRG.Name),
|
||||
RegisterComputes: types.BoolValue(recordRG.RegisterComputes),
|
||||
ResourceLimits: flattenResourceLimits(ctx, &recordRG.ResourceLimits),
|
||||
ResourceTypes: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordRG.ResTypes),
|
||||
Secret: types.StringValue(recordRG.Secret),
|
||||
|
||||
@@ -71,7 +71,6 @@ func RGListDataSource(ctx context.Context, state *models.DataSourceRGListModel,
|
||||
Milestones: types.Int64Value(int64(rgItem.Milestones)),
|
||||
Name: types.StringValue(rgItem.Name),
|
||||
ResTypes: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &rgItem.ResTypes),
|
||||
RegisterComputes: types.BoolValue(rgItem.RegisterComputes),
|
||||
ResourceLimits: flattenResourceLimits(ctx, &rgItem.ResourceLimits),
|
||||
Secret: types.StringValue(rgItem.Secret),
|
||||
Status: types.StringValue(rgItem.Status),
|
||||
|
||||
@@ -70,7 +70,6 @@ func RGListDeletedDataSource(ctx context.Context, state *models.DataSourceRGList
|
||||
Milestones: types.Int64Value(int64(rgItem.Milestones)),
|
||||
Name: types.StringValue(rgItem.Name),
|
||||
ResTypes: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &rgItem.ResTypes),
|
||||
RegisterComputes: types.BoolValue(rgItem.RegisterComputes),
|
||||
ResourceLimits: flattenResourceLimits(ctx, &rgItem.ResourceLimits),
|
||||
Secret: types.StringValue(rgItem.Secret),
|
||||
Status: types.StringValue(rgItem.Status),
|
||||
|
||||
@@ -84,11 +84,6 @@ func CreateRequestResourceRG(ctx context.Context, plan *models.ResourceRGModel)
|
||||
if !plan.ExtIP.IsNull() {
|
||||
createReq.ExtIP = plan.ExtIP.ValueString()
|
||||
}
|
||||
if plan.RegisterComputes.IsNull() {
|
||||
createReq.RegisterComputes = false // default value
|
||||
} else {
|
||||
createReq.RegisterComputes = plan.RegisterComputes.ValueBool()
|
||||
}
|
||||
if !plan.UniqPools.IsUnknown() {
|
||||
uniqPools := make([]string, 0, len(plan.UniqPools.Elements()))
|
||||
diags := plan.UniqPools.ElementsAs(ctx, &uniqPools, true)
|
||||
@@ -177,19 +172,6 @@ func UpdateRG(ctx context.Context, rgId uint64, plan, state *models.ResourceRGMo
|
||||
updateNeeded = true
|
||||
}
|
||||
|
||||
if !plan.RegisterComputes.Equal(state.RegisterComputes) {
|
||||
if plan.RegisterComputes.IsNull() {
|
||||
updateReq.RegisterComputes = false // default value
|
||||
} else {
|
||||
updateReq.RegisterComputes = plan.RegisterComputes.ValueBool()
|
||||
}
|
||||
tflog.Info(ctx, "utilityUpdateRG: new register_computes specified", map[string]any{
|
||||
"rg_id": plan.Id.ValueString(),
|
||||
"register_computes_plan": plan.RegisterComputes.ValueBool(),
|
||||
"register_computes_state": state.RegisterComputes.ValueBool()})
|
||||
updateNeeded = true
|
||||
}
|
||||
|
||||
var updResLimitsNeeded bool
|
||||
|
||||
var resLimitsPlan, resLimitsState models.ResourceLimitsModel
|
||||
|
||||
Reference in New Issue
Block a user