1.3.0
This commit is contained in:
@@ -83,6 +83,7 @@ func BServiceGroupDataSource(ctx context.Context, state *models.RecordGroupModel
|
||||
ID: types.Int64Value(int64(v.ID)),
|
||||
IPAddresses: flattens.FlattenSimpleTypeToList(ctx, types.StringType, ipAddresses),
|
||||
Name: types.StringValue(v.Name),
|
||||
Chipset: types.StringValue(v.Chipset),
|
||||
OSUsers: osUsers,
|
||||
}
|
||||
computesList = append(computesList, temp)
|
||||
|
||||
@@ -57,6 +57,7 @@ func BServiceGroupResource(ctx context.Context, plan *models.ResourceRecordGroup
|
||||
RAM: types.Int64Value(int64(recordResourceGroup.RAM)),
|
||||
Disk: types.Int64Value(int64(recordResourceGroup.Disk)),
|
||||
ImageID: types.Int64Value(int64(recordResourceGroup.ImageID)),
|
||||
Chipset: plan.Chipset,
|
||||
Driver: types.StringValue(recordResourceGroup.Driver),
|
||||
SEPID: types.Int64Value(int64(recordResourceGroup.SEPID)),
|
||||
SepPool: types.StringValue(recordResourceGroup.PoolName),
|
||||
@@ -112,6 +113,7 @@ func flattenGroupComputes(ctx context.Context, items bservice.ListGroupComputes)
|
||||
ID: types.Int64Value(int64(v.ID)),
|
||||
Name: types.StringValue(v.Name),
|
||||
IPAddresses: flattens.FlattenSimpleTypeToList(ctx, types.StringType, v.IPAddresses),
|
||||
Chipset: types.StringValue(v.Chipset),
|
||||
OSUsers: flattenOSuser(ctx, v.OSUsers),
|
||||
}
|
||||
obj, diags := types.ObjectValueFrom(ctx, models.ResourceItemGroupCompute, temp)
|
||||
|
||||
@@ -48,6 +48,7 @@ type ItemGroupComputeModel struct {
|
||||
ID types.Int64 `tfsdk:"id"`
|
||||
IPAddresses types.List `tfsdk:"ip_addresses"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
OSUsers []ItemOSUserModel `tfsdk:"os_users"`
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ type ResourceRecordGroupModel struct {
|
||||
SepPool types.String `tfsdk:"sep_pool"`
|
||||
CloudInit types.String `tfsdk:"cloud_init"`
|
||||
Role types.String `tfsdk:"role"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
TimeoutStart types.Int64 `tfsdk:"timeout_start"`
|
||||
VINSes types.List `tfsdk:"vinses"`
|
||||
ExtNets types.List `tfsdk:"extnets"`
|
||||
@@ -61,6 +62,7 @@ type ResourceItemGroupComputeModel struct {
|
||||
ID types.Int64 `tfsdk:"id"`
|
||||
IPAddresses types.List `tfsdk:"ip_addresses"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Chipset types.String `tfsdk:"chipset"`
|
||||
OSUsers types.List `tfsdk:"os_users"`
|
||||
}
|
||||
|
||||
@@ -68,6 +70,7 @@ var ResourceItemGroupCompute = map[string]attr.Type{
|
||||
"id": types.Int64Type,
|
||||
"ip_addresses": types.ListType{ElemType: types.StringType},
|
||||
"name": types.StringType,
|
||||
"chipset": types.StringType,
|
||||
"os_users": types.ListType{ElemType: types.ObjectType{AttrTypes: ResourceItemOSUser}},
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ func MakeSchemaDataSourceBServiceGroup() map[string]schema.Attribute {
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"os_users": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
|
||||
@@ -2,6 +2,7 @@ package schemas
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
@@ -24,15 +25,23 @@ func MakeSchemaResourceBService() map[string]schema.Attribute {
|
||||
},
|
||||
"permanently": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(true),
|
||||
},
|
||||
"enable": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(true),
|
||||
},
|
||||
"restore": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(false),
|
||||
},
|
||||
"start": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(false),
|
||||
},
|
||||
"service_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
|
||||
"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"
|
||||
@@ -42,6 +43,13 @@ func MakeSchemaResourceBServiceGroup() map[string]schema.Attribute {
|
||||
"driver": schema.StringAttribute{
|
||||
Required: true,
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Validators: []validator.String{
|
||||
stringvalidator.OneOf("i440fx", "Q35"),
|
||||
},
|
||||
Description: "Type of the emulated system, Q35 or i440fx",
|
||||
},
|
||||
"sep_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
@@ -79,12 +87,18 @@ func MakeSchemaResourceBServiceGroup() map[string]schema.Attribute {
|
||||
},
|
||||
"start": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(false),
|
||||
},
|
||||
"force_stop": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(false),
|
||||
},
|
||||
"force_update": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Default: booldefault.StaticBool(false),
|
||||
},
|
||||
"parents": schema.ListAttribute{
|
||||
Optional: true,
|
||||
@@ -119,6 +133,10 @@ func MakeSchemaResourceBServiceGroup() map[string]schema.Attribute {
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"chipset": schema.StringAttribute{
|
||||
Computed: true,
|
||||
Description: "Type of the emulated system, Q35 or i440fx",
|
||||
},
|
||||
"os_users": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
|
||||
@@ -48,6 +48,12 @@ func BServiceGroupResourceCreate(ctx context.Context, plan *models.ResourceRecor
|
||||
req.SEPID = uint64(plan.SEPID.ValueInt64())
|
||||
}
|
||||
|
||||
if plan.Chipset.IsNull() {
|
||||
req.Chipset = "i440fx"
|
||||
} else {
|
||||
req.Chipset = plan.Chipset.ValueString()
|
||||
}
|
||||
|
||||
if !plan.SepPool.IsNull() {
|
||||
req.SEPPool = plan.SepPool.ValueString()
|
||||
}
|
||||
@@ -131,6 +137,12 @@ func BServiceGroupResize(ctx context.Context, plan *models.ResourceRecordGroupMo
|
||||
Mode: plan.Mode.ValueString(),
|
||||
}
|
||||
|
||||
if plan.Chipset.IsNull() {
|
||||
req.Chipset = "i440fx"
|
||||
} else {
|
||||
req.Chipset = plan.Chipset.ValueString()
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "BServiceGroupResize: before calling CloudAPI().BService().GroupResize", map[string]any{"req": req})
|
||||
_, err = c.CloudAPI().BService().GroupResize(ctx, req)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user