Skip to content
Merged
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
12 changes: 1 addition & 11 deletions stackit/internal/services/mongodbflex/user/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import (
"net/http"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"

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

// Schema defines the schema for the resource.
func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
rolesOptions := []string{"read", "readWrite"}

descriptions := map[string]string{
"main": "MongoDB Flex user resource schema. Must have a `region` specified in the provider configuration.",
"id": "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`,`user_id`\".",
"user_id": "User ID.",
"instance_id": "ID of the MongoDB Flex instance.",
"project_id": "STACKIT project ID to which the instance is associated.",
"roles": "Database access levels for the user. " + utils.SupportedValuesDocumentation(rolesOptions),
"roles": "Database access levels for the user. Some of the possible values are: [`read`, `readWrite`, `readWriteAnyDatabase`]",
}

resp.Schema = schema.Schema{
Expand Down Expand Up @@ -167,11 +162,6 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: descriptions["roles"],
ElementType: types.StringType,
Required: true,
Validators: []validator.Set{
setvalidator.ValueStringsAre(
stringvalidator.OneOf(rolesOptions...),
),
},
},
"database": schema.StringAttribute{
Required: true,
Expand Down