From a29c954c84815d7d05b5a32a3efa6cd06c967b53 Mon Sep 17 00:00:00 2001 From: Henrique Santos <118177985+hcsa73@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:05:19 +0000 Subject: [PATCH] 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 --- docs/data-sources/argus_scrapeconfig.md | 4 +-- docs/data-sources/loadbalancer.md | 12 ++++++++ docs/data-sources/postgresql_credential.md | 3 ++ docs/data-sources/postgresql_instance.md | 3 ++ docs/index.md | 28 +++++++++++++++++++ docs/resources/argus_scrapeconfig.md | 2 +- docs/resources/loadbalancer.md | 11 +++++++- docs/resources/postgresql_credential.md | 3 ++ docs/resources/postgresql_instance.md | 3 ++ go.mod | 2 +- go.sum | 2 ++ .../postgresql/credential/datasource.go | 15 +++++++++- .../postgresql/credential/resource.go | 14 +++++++++- .../postgresql/instance/datasource.go | 15 +++++++++- .../services/postgresql/instance/resource.go | 14 +++++++++- 15 files changed, 122 insertions(+), 9 deletions(-) diff --git a/docs/data-sources/argus_scrapeconfig.md b/docs/data-sources/argus_scrapeconfig.md index 08c63f09..8ba26b03 100644 --- a/docs/data-sources/argus_scrapeconfig.md +++ b/docs/data-sources/argus_scrapeconfig.md @@ -34,7 +34,7 @@ data "stackit_argus_scrapeconfig" "example" { - `basic_auth` (Attributes) A basic authentication block. (see [below for nested schema](#nestedatt--basic_auth)) - `id` (String) Terraform's internal data source. ID. It is structured as "`project_id`,`instance_id`,`name`". - `metrics_path` (String) Specifies the job scraping url path. -- `saml2` (Attributes) A SAML2 configuration block (see [below for nested schema](#nestedatt--saml2)) +- `saml2` (Attributes) A SAML2 configuration block. (see [below for nested schema](#nestedatt--saml2)) - `sample_limit` (Number) Specifies the scrape sample limit. - `scheme` (String) Specifies the http scheme. - `scrape_interval` (String) Specifies the scrape interval as duration string. @@ -55,7 +55,7 @@ Read-Only: Read-Only: -- `enable_url_parameters` (Boolean) Are URL parameters be enabled? +- `enable_url_parameters` (Boolean) Specifies if URL parameters are enabled diff --git a/docs/data-sources/loadbalancer.md b/docs/data-sources/loadbalancer.md index 6a66d85a..013dd6bf 100644 --- a/docs/data-sources/loadbalancer.md +++ b/docs/data-sources/loadbalancer.md @@ -69,6 +69,10 @@ Read-Only: ### Nested Schema for `target_pools` +Optional: + +- `session_persistence` (Attributes) Here you can setup various session persistence options, so far only "`use_source_ip_address`" is supported. (see [below for nested schema](#nestedatt--target_pools--session_persistence)) + Read-Only: - `active_health_check` (Attributes) (see [below for nested schema](#nestedatt--target_pools--active_health_check)) @@ -76,6 +80,14 @@ Read-Only: - `target_port` (Number) Identical port number where each target listens for traffic. - `targets` (Attributes List) List of all targets which will be used in the pool. Limited to 250. (see [below for nested schema](#nestedatt--target_pools--targets)) + +### Nested Schema for `target_pools.session_persistence` + +Optional: + +- `use_source_ip_address` (Boolean) If true then all connections from one source IP address are redirected to the same target. This setting changes the load balancing algorithm to Maglev. + + ### Nested Schema for `target_pools.active_health_check` diff --git a/docs/data-sources/postgresql_credential.md b/docs/data-sources/postgresql_credential.md index 3c2785d9..e51d8f73 100644 --- a/docs/data-sources/postgresql_credential.md +++ b/docs/data-sources/postgresql_credential.md @@ -4,12 +4,15 @@ page_title: "stackit_postgresql_credential Data Source - stackit" subcategory: "" description: |- PostgreSQL credential data source schema. Must have a region specified in the provider configuration. + !> 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 stackitpostgresflexuser instead. For more details, check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html --- # stackit_postgresql_credential (Data Source) PostgreSQL credential data source schema. Must have a `region` specified in the provider configuration. +!> 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 + ## Example Usage ```terraform diff --git a/docs/data-sources/postgresql_instance.md b/docs/data-sources/postgresql_instance.md index 73900305..046e1e2e 100644 --- a/docs/data-sources/postgresql_instance.md +++ b/docs/data-sources/postgresql_instance.md @@ -4,12 +4,15 @@ page_title: "stackit_postgresql_instance Data Source - stackit" subcategory: "" description: |- PostgreSQL instance data source schema. Must have a region specified in the provider configuration. + !> 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 stackitpostgresflexinstance instead. For more details, check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html --- # stackit_postgresql_instance (Data Source) PostgreSQL instance data source schema. Must have a `region` specified in the provider configuration. +!> 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 + ## Example Usage ```terraform diff --git a/docs/index.md b/docs/index.md index 5e40041a..51208252 100644 --- a/docs/index.md +++ b/docs/index.md @@ -107,6 +107,34 @@ Using this flow is less secure since the token is long-lived. You can provide th 2. Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN` 3. Setting it in the credentials file (see above) +# Backend configuration + +To keep track of your terraform state, you can configure an [S3 backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3) using [STACKIT Object Storage](https://docs.stackit.cloud/stackit/en/object-storage-s3-compatible-71009778.html). + +To do so, you need an Object Storage [S3 bucket](https://docs.stackit.cloud/stackit/en/basic-concept-objectstorage-71009785.html#BasicConceptObjectStorage-Buckets) and [credentials](https://docs.stackit.cloud/stackit/en/basic-concept-objectstorage-71009785.html#BasicConceptObjectStorage-Credentials) to access it. If you need to create them, check [Getting Started - Object Storage](https://docs.stackit.cloud/stackit/en/getting-started-objectstorage-71009792.html). + +Once you have everything setup, you can configure the backend by adding the following block to your terraform configuration: + +``` +terraform { + backend "s3" { + bucket = "BUCKET_NAME" + key = "path/to/key" + endpoints = { + s3 = "https://object.storage.eu01.onstackit.cloud" + } + region = "eu01" + skip_credentials_validation = true + skip_region_validation = true + skip_s3_checksum = true + skip_requesting_account_id = true + secret_key = "SECRET_KEY" + access_key = "ACCESS_KEY" + } +} +``` + +Note: AWS specific checks must be skipped as they do not work on STACKIT. For details on what those validations do, see [here](https://developer.hashicorp.com/terraform/language/settings/backends/s3#configuration). ## Schema diff --git a/docs/resources/argus_scrapeconfig.md b/docs/resources/argus_scrapeconfig.md index 5247f852..6cc16b9c 100644 --- a/docs/resources/argus_scrapeconfig.md +++ b/docs/resources/argus_scrapeconfig.md @@ -82,4 +82,4 @@ Required: Optional: -- `enable_url_parameters` (Boolean) Are URL parameters be enabled? +- `enable_url_parameters` (Boolean) Specifies if URL parameters are enabled. diff --git a/docs/resources/loadbalancer.md b/docs/resources/loadbalancer.md index 1d36d8b0..06aa0647 100644 --- a/docs/resources/loadbalancer.md +++ b/docs/resources/loadbalancer.md @@ -59,7 +59,7 @@ provider "openstack" { } ``` - + ### Configuring the supporting infrastructure The example below uses OpenStack to create the network, router, a public IP address and a compute instance. @@ -229,6 +229,7 @@ Required: Optional: - `active_health_check` (Attributes) (see [below for nested schema](#nestedatt--target_pools--active_health_check)) +- `session_persistence` (Attributes) Here you can setup various session persistence options, so far only "`use_source_ip_address`" is supported. (see [below for nested schema](#nestedatt--target_pools--session_persistence)) ### Nested Schema for `target_pools.targets` @@ -251,6 +252,14 @@ Optional: - `unhealthy_threshold` (Number) Unhealthy threshold of the health checking. + +### Nested Schema for `target_pools.session_persistence` + +Optional: + +- `use_source_ip_address` (Boolean) If true then all connections from one source IP address are redirected to the same target. This setting changes the load balancing algorithm to Maglev. + + ### Nested Schema for `options` diff --git a/docs/resources/postgresql_credential.md b/docs/resources/postgresql_credential.md index d00dbe61..7733f8df 100644 --- a/docs/resources/postgresql_credential.md +++ b/docs/resources/postgresql_credential.md @@ -4,12 +4,15 @@ page_title: "stackit_postgresql_credential Resource - stackit" subcategory: "" description: |- PostgreSQL credential resource schema. Must have a region specified in the provider configuration. + !> The STACKIT PostgreSQL service will reach its end of support on June 30th 2024. Resources of this type will stop working after that. Use stackitpostgresflexuser instead. For more details, check https://docs.stackit.cloud/stackit/en/bring-your-data-to-stackit-postgresql-flex-138347648.html --- # stackit_postgresql_credential (Resource) PostgreSQL credential resource schema. Must have a `region` specified in the provider configuration. +!> 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 + ## Example Usage ```terraform diff --git a/docs/resources/postgresql_instance.md b/docs/resources/postgresql_instance.md index d23c7340..574d7258 100644 --- a/docs/resources/postgresql_instance.md +++ b/docs/resources/postgresql_instance.md @@ -4,12 +4,15 @@ page_title: "stackit_postgresql_instance Resource - stackit" subcategory: "" description: |- PostgreSQL instance resource schema. Must have a region specified in the provider configuration. + !> The STACKIT PostgreSQL service will reach its end of support on June 30th 2024. Resources of this type will stop working after that. Use stackitpostgresflexinstance 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) --- # stackit_postgresql_instance (Resource) PostgreSQL instance resource schema. Must have a `region` specified in the provider configuration. +!> 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) + ## Example Usage ```terraform diff --git a/go.mod b/go.mod index 26d3d792..f23106dd 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.5 github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.10.0 github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.0 - github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.11.0 + github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.12.0 github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0 github.com/stackitcloud/stackit-sdk-go/services/redis v0.10.0 github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.6 diff --git a/go.sum b/go.sum index 6d7f3a1c..5ce46502 100644 --- a/go.sum +++ b/go.sum @@ -174,6 +174,8 @@ github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.0 h1:b4RFEDSMa github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.0/go.mod h1:bVXMSjQH1eGUF5IoPAD8BjAzhRMunDlnrwLsaCPgRQ4= github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.11.0 h1:c9VUZ/hqeNWCbuuzUTwAjijGwd1q7oF2ACdLdo4hZ0A= github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.11.0/go.mod h1:jAWmjZv4/e97B5DHgqfq2toRuClIl93h4T5+opyUqtM= +github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.12.0 h1:Ud9IT71e8oJcs7hSiJF2k8wysz3+zzTyYQJwMuM8J6Q= +github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.12.0/go.mod h1:8tWbOEdgd8GanzMj3Z/cdMW6uhvNrBEJ8ZLtRYNsY4Y= github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0 h1:Fle394socpyf662g3jMrtZpZaWVgBMBIEFnh4fnGock= github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0/go.mod h1:JvqOSrTCiynS0x6Y9OsK54yvdB6AtIWLwXDEjoCkAIg= github.com/stackitcloud/stackit-sdk-go/services/redis v0.10.0 h1:4u+OiVDAI6Hpej81e+YrbzN5FT4l7ZrTw+eSRcQnCYg= diff --git a/stackit/internal/services/postgresql/credential/datasource.go b/stackit/internal/services/postgresql/credential/datasource.go index 235a940d..99b63c47 100644 --- a/stackit/internal/services/postgresql/credential/datasource.go +++ b/stackit/internal/services/postgresql/credential/datasource.go @@ -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"], diff --git a/stackit/internal/services/postgresql/credential/resource.go b/stackit/internal/services/postgresql/credential/resource.go index 1b416811..4b941412 100644 --- a/stackit/internal/services/postgresql/credential/resource.go +++ b/stackit/internal/services/postgresql/credential/resource.go @@ -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"], diff --git a/stackit/internal/services/postgresql/instance/datasource.go b/stackit/internal/services/postgresql/instance/datasource.go index 2212228e..b5291e6a 100644 --- a/stackit/internal/services/postgresql/instance/datasource.go +++ b/stackit/internal/services/postgresql/instance/datasource.go @@ -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"], diff --git a/stackit/internal/services/postgresql/instance/resource.go b/stackit/internal/services/postgresql/instance/resource.go index a4d38b20..9004c926 100644 --- a/stackit/internal/services/postgresql/instance/resource.go +++ b/stackit/internal/services/postgresql/instance/resource.go @@ -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"],