chore: changed and refactored providers #36
1 changed files with 11 additions and 3 deletions
|
|
@ -7,10 +7,12 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/conversion"
|
"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"
|
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"
|
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-framework/datasource"
|
||||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
"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.",
|
Description: "STACKIT project ID to which the instance is associated.",
|
||||||
MarkdownDescription: "STACKIT project ID to which the instance is associated.",
|
MarkdownDescription: "STACKIT project ID to which the instance is associated.",
|
||||||
Required: true,
|
Required: true,
|
||||||
|
Validators: []validator.String{
|
||||||
|
validate.UUID(),
|
||||||
|
validate.NoSeparator(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
s.Attributes["instance_id"] = schema.StringAttribute{
|
s.Attributes["instance_id"] = schema.StringAttribute{
|
||||||
Description: "ID of the PostgresFlex instance.",
|
Description: "ID of the PostgresFlex instance.",
|
||||||
MarkdownDescription: "ID of the PostgresFlex instance.",
|
MarkdownDescription: "ID of the PostgresFlex instance.",
|
||||||
Required: true,
|
Required: true,
|
||||||
|
Validators: []validator.String{
|
||||||
|
validate.UUID(),
|
||||||
|
validate.NoSeparator(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
s.Attributes["region"] = schema.StringAttribute{
|
s.Attributes["region"] = schema.StringAttribute{
|
||||||
Description: "Region of the PostgresFlex instance.",
|
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{
|
s.Attributes["database_id"] = schema.Int64Attribute{
|
||||||
Description: "The ID of the database.",
|
Description: "The ID of the database.",
|
||||||
Optional: true,
|
Required: true,
|
||||||
Computed: true,
|
|
||||||
}
|
}
|
||||||
s.Attributes["id"] = schema.StringAttribute{
|
s.Attributes["id"] = schema.StringAttribute{
|
||||||
Description: "Terraform's internal resource ID. It is structured as \\\"`project_id`,`region`,`instance_id`," +
|
Description: "Terraform's internal resource ID. It is structured as \\\"`project_id`,`region`,`instance_id`," +
|
||||||
"`database_id`\\\".\",",
|
"`database_id`\\\".\",",
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
Computed: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue