Add deprecation message for postgresql resources and data sources (#247)

* Update dependency

* Add deprecation messages

* Modify markdown description

* Add year

* Typo fix

---------

Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
Henrique Santos 2024-02-06 15:05:19 +00:00 committed by GitHub
parent b171e8a745
commit a29c954c84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 122 additions and 9 deletions

View file

@ -3,6 +3,7 @@ package postgresql
import (
"context"
"fmt"
"strings"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
@ -75,7 +76,16 @@ func (r *credentialDataSource) Configure(ctx context.Context, req datasource.Con
// Schema defines the schema for the data source.
func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
descriptions := map[string]string{
"main": "PostgreSQL credential data source schema. Must have a `region` specified in the provider configuration.",
"main": "PostgreSQL credential data source schema. Must have a `region` specified in the provider configuration.",
"deprecation_message": strings.Join(
[]string{
"The STACKIT PostgreSQL service will reach its end of support on June 30th 2024.",
"Data sources of this type will stop working after that.",
"Use stackit_postgresflex_user instead.",
"For more details, check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html",
},
" ",
),
"id": "Terraform's internal data source. identifier. It is structured as \"`project_id`,`instance_id`,`credential_id`\".",
"credential_id": "The credential's ID.",
"instance_id": "ID of the PostgreSQL instance.",
@ -84,6 +94,9 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
resp.Schema = schema.Schema{
Description: descriptions["main"],
// Callout block: https://developer.hashicorp.com/terraform/registry/providers/docs#callouts
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["deprecation_message"]),
DeprecationMessage: descriptions["deprecation_message"],
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: descriptions["id"],

View file

@ -98,7 +98,16 @@ func (r *credentialResource) Configure(ctx context.Context, req resource.Configu
// Schema defines the schema for the resource.
func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
descriptions := map[string]string{
"main": "PostgreSQL credential resource schema. Must have a `region` specified in the provider configuration.",
"main": "PostgreSQL credential resource schema. Must have a `region` specified in the provider configuration.",
"deprecation_message": strings.Join(
[]string{
"The STACKIT PostgreSQL service will reach its end of support on June 30th 2024.",
"Resources of this type will stop working after that.",
"Use stackit_postgresflex_user instead.",
"For more details, check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html",
},
" ",
),
"id": "Terraform's internal resource identifier. It is structured as \"`project_id`,`instance_id`,`credential_id`\".",
"credential_id": "The credential's ID.",
"instance_id": "ID of the PostgreSQL instance.",
@ -107,6 +116,9 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
resp.Schema = schema.Schema{
Description: descriptions["main"],
// Callout block: https://developer.hashicorp.com/terraform/registry/providers/docs#callouts
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["deprecation_message"]),
DeprecationMessage: descriptions["deprecation_message"],
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: descriptions["id"],

View file

@ -3,6 +3,7 @@ package postgresql
import (
"context"
"fmt"
"strings"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
@ -75,7 +76,16 @@ func (r *instanceDataSource) Configure(ctx context.Context, req datasource.Confi
// Schema defines the schema for the data source.
func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
descriptions := map[string]string{
"main": "PostgreSQL instance data source schema. Must have a `region` specified in the provider configuration.",
"main": "PostgreSQL instance data source schema. Must have a `region` specified in the provider configuration.",
"deprecation_message": strings.Join(
[]string{
"The STACKIT PostgreSQL service will reach its end of support on June 30th 2024.",
"Data sources of this type will stop working after that.",
"Use stackit_postgresflex_instance instead.",
"For more details, check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html",
},
" ",
),
"id": "Terraform's internal data source. identifier. It is structured as \"`project_id`,`instance_id`\".",
"instance_id": "ID of the PostgreSQL instance.",
"project_id": "STACKIT Project ID to which the instance is associated.",
@ -87,6 +97,9 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
resp.Schema = schema.Schema{
Description: descriptions["main"],
// Callout block: https://developer.hashicorp.com/terraform/registry/providers/docs#callouts
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["deprecation_message"]),
DeprecationMessage: descriptions["deprecation_message"],
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: descriptions["id"],

View file

@ -122,7 +122,16 @@ func (r *instanceResource) Configure(ctx context.Context, req resource.Configure
// Schema defines the schema for the resource.
func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
descriptions := map[string]string{
"main": "PostgreSQL instance resource schema. Must have a `region` specified in the provider configuration.",
"main": "PostgreSQL instance resource schema. Must have a `region` specified in the provider configuration.",
"deprecation_message": strings.Join(
[]string{
"The STACKIT PostgreSQL service will reach its end of support on June 30th 2024.",
"Resources of this type will stop working after that.",
"Use stackit_postgresflex_instance instead.",
"Check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html on how to backup and restore an instance from PostgreSQL to PostgreSQL Flex, then import the resource to Terraform using an \"import\" block (https://developer.hashicorp.com/terraform/language/import)",
},
" ",
),
"id": "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`\".",
"instance_id": "ID of the PostgreSQL instance.",
"project_id": "STACKIT project ID to which the instance is associated.",
@ -134,6 +143,9 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
resp.Schema = schema.Schema{
Description: descriptions["main"],
// Callout block: https://developer.hashicorp.com/terraform/registry/providers/docs#callouts
MarkdownDescription: fmt.Sprintf("%s\n\n!> %s", descriptions["main"], descriptions["deprecation_message"]),
DeprecationMessage: descriptions["deprecation_message"],
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: descriptions["id"],