Skip to content

Commit 5f3faac

Browse files
authored
Remove user role field validation from MongoDB flex user resource (#503)
* remove validation * change field description
1 parent ae5ccdc commit 5f3faac

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

stackit/internal/services/mongodbflex/user/resource.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ import (
66
"net/http"
77
"strings"
88

9-
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
10-
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
119
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1210
"github.com/hashicorp/terraform-plugin-log/tflog"
1311
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
1412
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
15-
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
1613
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
1714

1815
"github.com/hashicorp/terraform-plugin-framework/attr"
@@ -100,15 +97,13 @@ func (r *userResource) Configure(ctx context.Context, req resource.ConfigureRequ
10097

10198
// Schema defines the schema for the resource.
10299
func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
103-
rolesOptions := []string{"read", "readWrite"}
104-
105100
descriptions := map[string]string{
106101
"main": "MongoDB Flex user resource schema. Must have a `region` specified in the provider configuration.",
107102
"id": "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`,`user_id`\".",
108103
"user_id": "User ID.",
109104
"instance_id": "ID of the MongoDB Flex instance.",
110105
"project_id": "STACKIT project ID to which the instance is associated.",
111-
"roles": "Database access levels for the user. " + utils.SupportedValuesDocumentation(rolesOptions),
106+
"roles": "Database access levels for the user. Some of the possible values are: [`read`, `readWrite`, `readWriteAnyDatabase`]",
112107
}
113108

114109
resp.Schema = schema.Schema{
@@ -167,11 +162,6 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
167162
Description: descriptions["roles"],
168163
ElementType: types.StringType,
169164
Required: true,
170-
Validators: []validator.Set{
171-
setvalidator.ValueStringsAre(
172-
stringvalidator.OneOf(rolesOptions...),
173-
),
174-
},
175165
},
176166
"database": schema.StringAttribute{
177167
Required: true,

0 commit comments

Comments
 (0)