fix: builder fix
fix: sqlserver upgrade to generated files
This commit is contained in:
parent
48d3dcb526
commit
762c39fbbd
19 changed files with 3931 additions and 1126 deletions
|
|
@ -26,6 +26,11 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
|
|||
Description: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.",
|
||||
MarkdownDescription: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.",
|
||||
},
|
||||
"edition": schema.StringAttribute{
|
||||
Computed: true,
|
||||
Description: "Edition of the MSSQL server instance",
|
||||
MarkdownDescription: "Edition of the MSSQL server instance",
|
||||
},
|
||||
"encryption": schema.SingleNestedAttribute{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"kek_key_id": schema.StringAttribute{
|
||||
|
|
@ -73,6 +78,11 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
|
|||
Description: "The ID of the instance.",
|
||||
MarkdownDescription: "The ID of the instance.",
|
||||
},
|
||||
"is_deletable": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
Description: "Whether the instance can be deleted or not.",
|
||||
MarkdownDescription: "Whether the instance can be deleted or not.",
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Required: true,
|
||||
Description: "The name of the instance.",
|
||||
|
|
@ -99,6 +109,12 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
|
|||
Description: "List of IPV4 cidr.",
|
||||
MarkdownDescription: "List of IPV4 cidr.",
|
||||
},
|
||||
"instance_address": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"router_address": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
CustomType: NetworkType{
|
||||
ObjectType: types.ObjectType{
|
||||
|
|
@ -126,11 +142,19 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
|
|||
),
|
||||
},
|
||||
},
|
||||
"replicas": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
Description: "How many replicas the instance should have.",
|
||||
MarkdownDescription: "How many replicas the instance should have.",
|
||||
},
|
||||
"retention_days": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "The days for how long the backup files should be stored before cleaned up. 30 to 365",
|
||||
MarkdownDescription: "The days for how long the backup files should be stored before cleaned up. 30 to 365",
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"storage": schema.SingleNestedAttribute{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"class": schema.StringAttribute{
|
||||
|
|
@ -169,15 +193,19 @@ func InstanceResourceSchema(ctx context.Context) schema.Schema {
|
|||
|
||||
type InstanceModel struct {
|
||||
BackupSchedule types.String `tfsdk:"backup_schedule"`
|
||||
Edition types.String `tfsdk:"edition"`
|
||||
Encryption EncryptionValue `tfsdk:"encryption"`
|
||||
FlavorId types.String `tfsdk:"flavor_id"`
|
||||
Id types.String `tfsdk:"id"`
|
||||
InstanceId types.String `tfsdk:"instance_id"`
|
||||
IsDeletable types.Bool `tfsdk:"is_deletable"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Network NetworkValue `tfsdk:"network"`
|
||||
ProjectId types.String `tfsdk:"project_id"`
|
||||
Region types.String `tfsdk:"region"`
|
||||
Replicas types.Int64 `tfsdk:"replicas"`
|
||||
RetentionDays types.Int64 `tfsdk:"retention_days"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
Storage StorageValue `tfsdk:"storage"`
|
||||
Version types.String `tfsdk:"version"`
|
||||
}
|
||||
|
|
@ -732,14 +760,52 @@ func (t NetworkType) ValueFromObject(ctx context.Context, in basetypes.ObjectVal
|
|||
fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute))
|
||||
}
|
||||
|
||||
instanceAddressAttribute, ok := attributes["instance_address"]
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Missing",
|
||||
`instance_address is missing from object`)
|
||||
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
instanceAddressVal, ok := instanceAddressAttribute.(basetypes.StringValue)
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Wrong Type",
|
||||
fmt.Sprintf(`instance_address expected to be basetypes.StringValue, was: %T`, instanceAddressAttribute))
|
||||
}
|
||||
|
||||
routerAddressAttribute, ok := attributes["router_address"]
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Missing",
|
||||
`router_address is missing from object`)
|
||||
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
routerAddressVal, ok := routerAddressAttribute.(basetypes.StringValue)
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Wrong Type",
|
||||
fmt.Sprintf(`router_address expected to be basetypes.StringValue, was: %T`, routerAddressAttribute))
|
||||
}
|
||||
|
||||
if diags.HasError() {
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
return NetworkValue{
|
||||
AccessScope: accessScopeVal,
|
||||
Acl: aclVal,
|
||||
state: attr.ValueStateKnown,
|
||||
AccessScope: accessScopeVal,
|
||||
Acl: aclVal,
|
||||
InstanceAddress: instanceAddressVal,
|
||||
RouterAddress: routerAddressVal,
|
||||
state: attr.ValueStateKnown,
|
||||
}, diags
|
||||
}
|
||||
|
||||
|
|
@ -842,14 +908,52 @@ func NewNetworkValue(attributeTypes map[string]attr.Type, attributes map[string]
|
|||
fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute))
|
||||
}
|
||||
|
||||
instanceAddressAttribute, ok := attributes["instance_address"]
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Missing",
|
||||
`instance_address is missing from object`)
|
||||
|
||||
return NewNetworkValueUnknown(), diags
|
||||
}
|
||||
|
||||
instanceAddressVal, ok := instanceAddressAttribute.(basetypes.StringValue)
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Wrong Type",
|
||||
fmt.Sprintf(`instance_address expected to be basetypes.StringValue, was: %T`, instanceAddressAttribute))
|
||||
}
|
||||
|
||||
routerAddressAttribute, ok := attributes["router_address"]
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Missing",
|
||||
`router_address is missing from object`)
|
||||
|
||||
return NewNetworkValueUnknown(), diags
|
||||
}
|
||||
|
||||
routerAddressVal, ok := routerAddressAttribute.(basetypes.StringValue)
|
||||
|
||||
if !ok {
|
||||
diags.AddError(
|
||||
"Attribute Wrong Type",
|
||||
fmt.Sprintf(`router_address expected to be basetypes.StringValue, was: %T`, routerAddressAttribute))
|
||||
}
|
||||
|
||||
if diags.HasError() {
|
||||
return NewNetworkValueUnknown(), diags
|
||||
}
|
||||
|
||||
return NetworkValue{
|
||||
AccessScope: accessScopeVal,
|
||||
Acl: aclVal,
|
||||
state: attr.ValueStateKnown,
|
||||
AccessScope: accessScopeVal,
|
||||
Acl: aclVal,
|
||||
InstanceAddress: instanceAddressVal,
|
||||
RouterAddress: routerAddressVal,
|
||||
state: attr.ValueStateKnown,
|
||||
}, diags
|
||||
}
|
||||
|
||||
|
|
@ -921,13 +1025,15 @@ func (t NetworkType) ValueType(ctx context.Context) attr.Value {
|
|||
var _ basetypes.ObjectValuable = NetworkValue{}
|
||||
|
||||
type NetworkValue struct {
|
||||
AccessScope basetypes.StringValue `tfsdk:"access_scope"`
|
||||
Acl basetypes.ListValue `tfsdk:"acl"`
|
||||
state attr.ValueState
|
||||
AccessScope basetypes.StringValue `tfsdk:"access_scope"`
|
||||
Acl basetypes.ListValue `tfsdk:"acl"`
|
||||
InstanceAddress basetypes.StringValue `tfsdk:"instance_address"`
|
||||
RouterAddress basetypes.StringValue `tfsdk:"router_address"`
|
||||
state attr.ValueState
|
||||
}
|
||||
|
||||
func (v NetworkValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
|
||||
attrTypes := make(map[string]tftypes.Type, 2)
|
||||
attrTypes := make(map[string]tftypes.Type, 4)
|
||||
|
||||
var val tftypes.Value
|
||||
var err error
|
||||
|
|
@ -936,12 +1042,14 @@ func (v NetworkValue) ToTerraformValue(ctx context.Context) (tftypes.Value, erro
|
|||
attrTypes["acl"] = basetypes.ListType{
|
||||
ElemType: types.StringType,
|
||||
}.TerraformType(ctx)
|
||||
attrTypes["instance_address"] = basetypes.StringType{}.TerraformType(ctx)
|
||||
attrTypes["router_address"] = basetypes.StringType{}.TerraformType(ctx)
|
||||
|
||||
objectType := tftypes.Object{AttributeTypes: attrTypes}
|
||||
|
||||
switch v.state {
|
||||
case attr.ValueStateKnown:
|
||||
vals := make(map[string]tftypes.Value, 2)
|
||||
vals := make(map[string]tftypes.Value, 4)
|
||||
|
||||
val, err = v.AccessScope.ToTerraformValue(ctx)
|
||||
|
||||
|
|
@ -959,6 +1067,22 @@ func (v NetworkValue) ToTerraformValue(ctx context.Context) (tftypes.Value, erro
|
|||
|
||||
vals["acl"] = val
|
||||
|
||||
val, err = v.InstanceAddress.ToTerraformValue(ctx)
|
||||
|
||||
if err != nil {
|
||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
||||
}
|
||||
|
||||
vals["instance_address"] = val
|
||||
|
||||
val, err = v.RouterAddress.ToTerraformValue(ctx)
|
||||
|
||||
if err != nil {
|
||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
||||
}
|
||||
|
||||
vals["router_address"] = val
|
||||
|
||||
if err := tftypes.ValidateValue(objectType, vals); err != nil {
|
||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
||||
}
|
||||
|
|
@ -1006,6 +1130,8 @@ func (v NetworkValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue,
|
|||
"acl": basetypes.ListType{
|
||||
ElemType: types.StringType,
|
||||
},
|
||||
"instance_address": basetypes.StringType{},
|
||||
"router_address": basetypes.StringType{},
|
||||
}), diags
|
||||
}
|
||||
|
||||
|
|
@ -1014,6 +1140,8 @@ func (v NetworkValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue,
|
|||
"acl": basetypes.ListType{
|
||||
ElemType: types.StringType,
|
||||
},
|
||||
"instance_address": basetypes.StringType{},
|
||||
"router_address": basetypes.StringType{},
|
||||
}
|
||||
|
||||
if v.IsNull() {
|
||||
|
|
@ -1027,8 +1155,10 @@ func (v NetworkValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue,
|
|||
objVal, diags := types.ObjectValue(
|
||||
attributeTypes,
|
||||
map[string]attr.Value{
|
||||
"access_scope": v.AccessScope,
|
||||
"acl": aclVal,
|
||||
"access_scope": v.AccessScope,
|
||||
"acl": aclVal,
|
||||
"instance_address": v.InstanceAddress,
|
||||
"router_address": v.RouterAddress,
|
||||
})
|
||||
|
||||
return objVal, diags
|
||||
|
|
@ -1057,6 +1187,14 @@ func (v NetworkValue) Equal(o attr.Value) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if !v.InstanceAddress.Equal(other.InstanceAddress) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !v.RouterAddress.Equal(other.RouterAddress) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -1074,6 +1212,8 @@ func (v NetworkValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
|
|||
"acl": basetypes.ListType{
|
||||
ElemType: types.StringType,
|
||||
},
|
||||
"instance_address": basetypes.StringType{},
|
||||
"router_address": basetypes.StringType{},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue