Document possible values of schema fields (#455)

* Document possible values of schema fields

* Change from possible to supported
This commit is contained in:
João Palet 2024-07-09 13:14:38 +01:00 committed by GitHub
parent 846a2ba181
commit 3fb28d1248
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 76 additions and 15 deletions

View file

@ -12,6 +12,7 @@ import (
"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"
@ -100,12 +101,15 @@ 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{"login", "createdb"}
descriptions := map[string]string{
"main": "PostgresFlex 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 PostgresFlex instance.",
"project_id": "STACKIT project ID to which the instance is associated.",
"roles": "Database access levels for the user. " + utils.SupportedValuesDocumentation(rolesOptions),
}
resp.Schema = schema.Schema{
@ -159,6 +163,7 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
},
},
"roles": schema.SetAttribute{
Description: descriptions["roles"],
ElementType: types.StringType,
Required: true,
PlanModifiers: []planmodifier.Set{