Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/data-sources/rabbitmq_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ Read-Only:
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
- `syslog` (List of String) List of syslog servers to send logs to.
- `tls_ciphers` (List of String) List of TLS ciphers to use.
- `tls_protocols` (String) TLS protocol to use.
- `tls_protocols` (List of String) TLS protocol versions to use.
2 changes: 1 addition & 1 deletion docs/resources/rabbitmq_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ Optional:
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
- `syslog` (List of String) List of syslog servers to send logs to.
- `tls_ciphers` (List of String) List of TLS ciphers to use.
- `tls_protocols` (String) TLS protocol to use.
- `tls_protocols` (List of String) TLS protocol versions to use.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/observability v0.16.3
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.24.6
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.25.6
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.26.0
github.com/stackitcloud/stackit-sdk-go/services/redis v0.25.6
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.18.5
github.com/stackitcloud/stackit-sdk-go/services/scf v0.4.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.24.6 h1:oTVx1+O177
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.24.6/go.mod h1:6ZBeCCY6qG8w1oK7osf61Egyv3mp7Ahv6GDGxiarDGo=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5 h1:H67e3KnHQx954yI8fuQmxXwRf/myqAdLg2KvxImp00g=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5/go.mod h1:xmAWk9eom8wznvLuLfm0F4xyeiBX8LaggXsKFmos+dw=
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.25.6 h1:+TFfl1ON/uM5aO0FdkBNYKBa7vx0zrCYVtX6zvqQYBA=
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.25.6/go.mod h1:hnhvlLX1Y71R8KIQqLBeoSZqkU5ZJOG0J4wz0LeUdaw=
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.26.0 h1:/8lmviszgrB+0Cz7HdhFELyTiTeqIs7LfnI6sNX4rW8=
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.26.0/go.mod h1:hnhvlLX1Y71R8KIQqLBeoSZqkU5ZJOG0J4wz0LeUdaw=
github.com/stackitcloud/stackit-sdk-go/services/redis v0.25.6 h1:CXM9cZ9WeTyJd+Aw/hnJnDsKRVAQi4qgtd0RJ3zoPwo=
github.com/stackitcloud/stackit-sdk-go/services/redis v0.25.6/go.mod h1:KJNceOHRefjku1oVBoHG7idCS/SeW42WJ+55bN3AxrQ=
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.18.5 h1:MZ5aTO2NQ1Jecmi67ByGskve5nKXHl91fE+z+vFjxt4=
Expand Down
5 changes: 3 additions & 2 deletions stackit/internal/services/rabbitmq/instance/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
"roles": "List of roles to assign to the instance.",
"syslog": "List of syslog servers to send logs to.",
"tls_ciphers": "List of TLS ciphers to use.",
"tls_protocols": "TLS protocol to use.",
"tls_protocols": "TLS protocol versions to use.",
}

resp.Schema = schema.Schema{
Expand Down Expand Up @@ -177,8 +177,9 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
ElementType: types.StringType,
Computed: true,
},
"tls_protocols": schema.StringAttribute{
"tls_protocols": schema.ListAttribute{
Description: parametersDescriptions["tls_protocols"],
ElementType: types.StringType,
Computed: true,
},
},
Expand Down
15 changes: 10 additions & 5 deletions stackit/internal/services/rabbitmq/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type parametersModel struct {
Roles types.List `tfsdk:"roles"`
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
Expand All @@ -84,7 +84,7 @@ var parametersTypes = map[string]attr.Type{
"roles": 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.
Expand Down Expand Up @@ -144,7 +144,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
"roles": "List of roles to assign to the instance.",
"syslog": "List of syslog servers to send logs to.",
"tls_ciphers": "List of TLS ciphers to use.",
"tls_protocols": "TLS protocol to use.",
"tls_protocols": "TLS protocol versions to use.",
}

resp.Schema = schema.Schema{
Expand Down Expand Up @@ -274,8 +274,9 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Optional: true,
Computed: true,
},
"tls_protocols": schema.StringAttribute{
"tls_protocols": schema.ListAttribute{
Description: parametersDescriptions["tls_protocols"],
ElementType: types.StringType,
Optional: true,
Computed: true,
},
Expand Down Expand Up @@ -749,7 +750,6 @@ func toInstanceParams(parameters *parametersModel) (*rabbitmq.InstanceParameters
payloadParams.MetricsFrequency = conversion.Int64ValueToPointer(parameters.MetricsFrequency)
payloadParams.MetricsPrefix = conversion.StringValueToPointer(parameters.MetricsPrefix)
payloadParams.MonitoringInstanceId = conversion.StringValueToPointer(parameters.MonitoringInstanceId)
payloadParams.TlsProtocols = rabbitmq.InstanceParametersGetTlsProtocolsAttributeType(conversion.StringValueToPointer(parameters.TlsProtocols))

var err error
payloadParams.Plugins, err = conversion.StringListToPointer(parameters.Plugins)
Expand All @@ -772,6 +772,11 @@ func toInstanceParams(parameters *parametersModel) (*rabbitmq.InstanceParameters
return nil, fmt.Errorf("converting tls_ciphers: %w", err)
}

payloadParams.TlsProtocols, err = conversion.StringListToPointer(parameters.TlsProtocols)
if err != nil {
return nil, fmt.Errorf("converting tls_protocol_versions: %w", err)
}

return payloadParams, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ var fixtureModelParameters = types.ObjectValueMust(parametersTypes, map[string]a
types.StringValue("ciphers1"),
types.StringValue("ciphers2"),
}),
"tls_protocols": types.StringValue(string(rabbitmq.INSTANCEPARAMETERSTLS_PROTOCOLS__2)),
"tls_protocols": types.ListValueMust(types.StringType, []attr.Value{
types.StringValue("tlsv1.2"),
types.StringValue("tlsv1.3"),
}),
})

var fixtureInstanceParameters = rabbitmq.InstanceParameters{
Expand All @@ -53,7 +56,7 @@ var fixtureInstanceParameters = rabbitmq.InstanceParameters{
Roles: &[]string{"role1", "role2"},
Syslog: &[]string{"syslog", "syslog2"},
TlsCiphers: &[]string{"ciphers1", "ciphers2"},
TlsProtocols: rabbitmq.INSTANCEPARAMETERSTLS_PROTOCOLS__2.Ptr(),
TlsProtocols: &[]string{"tlsv1.2", "tlsv1.3"},
}

func TestMapFields(t *testing.T) {
Expand Down Expand Up @@ -105,7 +108,7 @@ func TestMapFields(t *testing.T) {
"roles": []string{"role1", "role2"},
"syslog": []string{"syslog", "syslog2"},
"tls-ciphers": []string{"ciphers1", "ciphers2"},
"tls-protocols": string(rabbitmq.INSTANCEPARAMETERSTLS_PROTOCOLS__2),
"tls-protocols": []string{"tlsv1.2", "tlsv1.3"},
},
},
Model{
Expand Down
Loading