diff --git a/stackit/internal/services/postgresflexalpha/database/datasource.go b/stackit/internal/services/postgresflexalpha/database/datasource.go index 3e526242..1c4de9bc 100644 --- a/stackit/internal/services/postgresflexalpha/database/datasource.go +++ b/stackit/internal/services/postgresflexalpha/database/datasource.go @@ -7,10 +7,12 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion" postgresflexalpha2 "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/database/datasources_gen" postgresflexUtils "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" + "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/validate" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -83,11 +85,19 @@ func (r *databaseDataSource) Schema(ctx context.Context, _ datasource.SchemaRequ Description: "STACKIT project ID to which the instance is associated.", MarkdownDescription: "STACKIT project ID to which the instance is associated.", Required: true, + Validators: []validator.String{ + validate.UUID(), + validate.NoSeparator(), + }, } s.Attributes["instance_id"] = schema.StringAttribute{ Description: "ID of the PostgresFlex instance.", MarkdownDescription: "ID of the PostgresFlex instance.", Required: true, + Validators: []validator.String{ + validate.UUID(), + validate.NoSeparator(), + }, } s.Attributes["region"] = schema.StringAttribute{ Description: "Region of the PostgresFlex instance.", @@ -96,13 +106,11 @@ func (r *databaseDataSource) Schema(ctx context.Context, _ datasource.SchemaRequ } s.Attributes["database_id"] = schema.Int64Attribute{ Description: "The ID of the database.", - Optional: true, - Computed: true, + Required: true, } s.Attributes["id"] = schema.StringAttribute{ Description: "Terraform's internal resource ID. It is structured as \\\"`project_id`,`region`,`instance_id`," + "`database_id`\\\".\",", - Optional: true, Computed: true, }