From 52a139b5f255921936f3133fe01a6a6c4d48e2bb Mon Sep 17 00:00:00 2001 From: Clemens Keppler Date: Mon, 12 Jan 2026 12:25:57 +0100 Subject: [PATCH 1/2] Remove the role validation for Postgres This allows the validation to happen on the API side. Currently, the API already allows creation with the "createrole", but the terraform provider doesn't. This is in-line with the change done in fda9622cbc206b6ddebe4b346aae9ff8266fe641 for sql-server. --- docs/resources/postgresflex_user.md | 2 +- .../internal/services/postgresflex/user/resource.go | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/resources/postgresflex_user.md b/docs/resources/postgresflex_user.md index 763e1e192..6ec390135 100644 --- a/docs/resources/postgresflex_user.md +++ b/docs/resources/postgresflex_user.md @@ -34,7 +34,7 @@ import { - `instance_id` (String) ID of the PostgresFlex instance. - `project_id` (String) STACKIT project ID to which the instance is associated. -- `roles` (Set of String) Database access levels for the user. Possible values are: `login`, `createdb`. +- `roles` (Set of String) Database access levels for the user. - `username` (String) ### Optional diff --git a/stackit/internal/services/postgresflex/user/resource.go b/stackit/internal/services/postgresflex/user/resource.go index 2b1416e3b..f097af51f 100644 --- a/stackit/internal/services/postgresflex/user/resource.go +++ b/stackit/internal/services/postgresflex/user/resource.go @@ -8,8 +8,6 @@ import ( postgresflexUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/postgresflex/utils" - "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" @@ -115,7 +113,6 @@ 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": "Postgres Flex user resource schema. Must have a `region` specified in the provider configuration.", @@ -123,7 +120,7 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp "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.FormatPossibleValues(rolesOptions...), + "roles": "Database access levels for the user.", "region": "The resource region. If not defined, the provider region is used.", } @@ -181,11 +178,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("login", "createdb"), - ), - }, }, "password": schema.StringAttribute{ Computed: true, From 5e01a268f037d530a78e00d4887f26818afc69ac Mon Sep 17 00:00:00 2001 From: Clemens Keppler Date: Mon, 12 Jan 2026 15:05:52 +0100 Subject: [PATCH 2/2] Remove empty line at beginning of function --- stackit/internal/services/postgresflex/user/resource.go | 1 - 1 file changed, 1 deletion(-) diff --git a/stackit/internal/services/postgresflex/user/resource.go b/stackit/internal/services/postgresflex/user/resource.go index f097af51f..4d5e9ffc1 100644 --- a/stackit/internal/services/postgresflex/user/resource.go +++ b/stackit/internal/services/postgresflex/user/resource.go @@ -113,7 +113,6 @@ 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) { - descriptions := map[string]string{ "main": "Postgres 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`,`region`,`instance_id`,`user_id`\".",