fix(deps): update stackit sdk modules (#894)

* fix(deps): update stackit sdk modules

* Adjust opensearch regarding breaking change

tls_protocol parameter is now a string array instead of a single string

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>

---------

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
Co-authored-by: Renovate Bot <renovate@whitesourcesoftware.com>
Co-authored-by: Alexander Dahmen <alexander.dahmen@inovex.de>
This commit is contained in:
stackit-pipeline 2025-07-01 10:47:07 +02:00 committed by GitHub
parent 04a3436a0c
commit d2c51afbe5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 33 deletions

View file

@ -69,7 +69,7 @@ type parametersModel struct {
Plugins types.List `tfsdk:"plugins"`
Syslog types.List `tfsdk:"syslog"`
TlsCiphers types.List `tfsdk:"tls_ciphers"`
TlsProtocols types.String `tfsdk:"tls_protocols"`
TlsProtocols types.List `tfsdk:"tls_protocols"`
}
// Types corresponding to parametersModel
@ -87,7 +87,7 @@ var parametersTypes = map[string]attr.Type{
"plugins": basetypes.ListType{ElemType: types.StringType},
"syslog": basetypes.ListType{ElemType: types.StringType},
"tls_ciphers": basetypes.ListType{ElemType: types.StringType},
"tls_protocols": basetypes.StringType{},
"tls_protocols": basetypes.ListType{ElemType: types.StringType},
}
// NewInstanceResource is a helper function to simplify the provider implementation.
@ -278,7 +278,8 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Optional: true,
Computed: true,
},
"tls_protocols": schema.StringAttribute{
"tls_protocols": schema.ListAttribute{
ElementType: types.StringType,
Description: parametersDescriptions["tls_protocols"],
Optional: true,
Computed: true,
@ -733,7 +734,6 @@ func toInstanceParams(parameters *parametersModel) (*opensearch.InstanceParamete
payloadParams.MetricsFrequency = conversion.Int64ValueToPointer(parameters.MetricsFrequency)
payloadParams.MetricsPrefix = conversion.StringValueToPointer(parameters.MetricsPrefix)
payloadParams.MonitoringInstanceId = conversion.StringValueToPointer(parameters.MonitoringInstanceId)
payloadParams.TlsProtocols = opensearch.InstanceParametersGetTlsProtocolsAttributeType(conversion.StringValueToPointer(parameters.TlsProtocols))
var err error
payloadParams.Plugins, err = conversion.StringListToPointer(parameters.Plugins)
@ -751,6 +751,11 @@ func toInstanceParams(parameters *parametersModel) (*opensearch.InstanceParamete
return nil, fmt.Errorf("convert tls_ciphers: %w", err)
}
payloadParams.TlsProtocols, err = conversion.StringListToPointer(parameters.TlsProtocols)
if err != nil {
return nil, fmt.Errorf("convert tls_protocols: %w", err)
}
return payloadParams, nil
}

View file

@ -35,7 +35,10 @@ var fixtureModelParameters = types.ObjectValueMust(parametersTypes, map[string]a
types.StringValue("cipher"),
types.StringValue("cipher2"),
}),
"tls_protocols": types.StringValue(string(opensearch.INSTANCEPARAMETERSTLS_PROTOCOLS__2)),
"tls_protocols": types.ListValueMust(types.StringType, []attr.Value{
types.StringValue("TLSv1.2"),
types.StringValue("TLSv1.3"),
}),
})
var fixtureNullModelParameters = types.ObjectValueMust(parametersTypes, map[string]attr.Value{
@ -52,7 +55,7 @@ var fixtureNullModelParameters = types.ObjectValueMust(parametersTypes, map[stri
"plugins": types.ListNull(types.StringType),
"syslog": types.ListNull(types.StringType),
"tls_ciphers": types.ListNull(types.StringType),
"tls_protocols": types.StringNull(),
"tls_protocols": types.ListNull(types.StringType),
})
var fixtureInstanceParameters = opensearch.InstanceParameters{
@ -69,7 +72,7 @@ var fixtureInstanceParameters = opensearch.InstanceParameters{
Plugins: &[]string{"plugin", "plugin2"},
Syslog: &[]string{"syslog", "syslog2"},
TlsCiphers: &[]string{"cipher", "cipher2"},
TlsProtocols: opensearch.INSTANCEPARAMETERSTLS_PROTOCOLS__2.Ptr(),
TlsProtocols: &[]string{"TLSv1.2", "TLSv1.3"},
}
func TestMapFields(t *testing.T) {
@ -123,7 +126,7 @@ func TestMapFields(t *testing.T) {
"plugins": []string{"plugin", "plugin2"},
"syslog": []string{"syslog", "syslog2"},
"tls-ciphers": []string{"cipher", "cipher2"},
"tls-protocols": string(opensearch.INSTANCEPARAMETERSTLS_PROTOCOLS__2),
"tls-protocols": []string{"TLSv1.2", "TLSv1.3"},
},
},
Model{