From 3b5ca4b2a38fe569535ece93651846fab354056c Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Thu, 6 Aug 2026 17:58:46 +0200 Subject: [PATCH 1/3] chore(postgres): deprecate v2 api fields --- docs/data-sources/postgresflex_instance.md | 4 ++-- docs/resources/postgresflex_instance.md | 6 +++--- .../services/postgresflex/instance/datasource.go | 8 +++++--- .../services/postgresflex/instance/resource.go | 16 +++++++++------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/data-sources/postgresflex_instance.md b/docs/data-sources/postgresflex_instance.md index 1b1566522..8a8abb928 100644 --- a/docs/data-sources/postgresflex_instance.md +++ b/docs/data-sources/postgresflex_instance.md @@ -37,12 +37,12 @@ data "stackit_postgresflex_instance" "example" { - `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. Must be a valid cron expression using numeric minute and hour values, e.g: '0 2 * * *'. - `connection_info` (Attributes) The connection info for the PostgresFlex instance. (see [below for nested schema](#nestedatt--connection_info)) - `encryption` (Attributes) (see [below for nested schema](#nestedatt--encryption)) -- `flavor` (Attributes) (see [below for nested schema](#nestedatt--flavor)) +- `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor)) - `flavor_id` (String) - `id` (String) Terraform's internal data source. ID. It is structured as "`project_id`,`region`,`instance_id`". - `name` (String) Instance name. - `network` (Attributes) (see [below for nested schema](#nestedatt--network)) -- `replicas` (Number) +- `replicas` (Number, Deprecated) - `retention_days` (Number) - `storage` (Attributes) (see [below for nested schema](#nestedatt--storage)) - `version` (String) diff --git a/docs/resources/postgresflex_instance.md b/docs/resources/postgresflex_instance.md index c96e6dcb7..27a4e64a2 100644 --- a/docs/resources/postgresflex_instance.md +++ b/docs/resources/postgresflex_instance.md @@ -46,13 +46,13 @@ resource "stackit_postgresflex_instance" "example" { - `acl` (List of String, Deprecated) The Access Control List (ACL) for the PostgresFlex instance. - `encryption` (Attributes) (see [below for nested schema](#nestedatt--encryption)) - `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor)) -- `flavor_id` (String) The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available storage classes using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli): +- `flavor_id` (String) The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available flavors using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli): ```bash -stackit curl https://postgres-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\?size=100 +stackit postgresflex flavor list ``` - `network` (Attributes) The network configuration of the instance. Will be required after February 2027. Set a value to prevent breaking changes. (see [below for nested schema](#nestedatt--network)) - `region` (String) The resource region. If not defined, the provider region is used. -- `replicas` (Number) How many replicas the instance should have. Valid values are 1 for single mode or 3 for replication. Can only be set together with `flavor` +- `replicas` (Number, Deprecated) How many replicas the instance should have. Valid values are 1 for single mode or 3 for replication. Can only be set together with `flavor` - `retention_days` (Number) How long backups are retained. The value can only be between 32 and 90 days. Will be required after February 2027. Set a value to prevent breaking changes. ### Read-Only diff --git a/stackit/internal/services/postgresflex/instance/datasource.go b/stackit/internal/services/postgresflex/instance/datasource.go index f35affe52..eb02561bf 100644 --- a/stackit/internal/services/postgresflex/instance/datasource.go +++ b/stackit/internal/services/postgresflex/instance/datasource.go @@ -137,7 +137,8 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques Computed: true, }, "flavor": schema.SingleNestedAttribute{ - Computed: true, + Computed: true, + DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -178,8 +179,9 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques }, }, "replicas": schema.Int32Attribute{ - Description: descriptions["replicas"], - Computed: true, + Description: descriptions["replicas"], + DeprecationMessage: "replicas is deprecated and will be removed after February 2027. Use instead `flavor_id` and choose a flavor with your wanted replica configuration. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", + Computed: true, }, "retention_days": schema.Int32Attribute{ Description: descriptions["retention_days"], diff --git a/stackit/internal/services/postgresflex/instance/resource.go b/stackit/internal/services/postgresflex/instance/resource.go index 6894e0980..b8e5b913d 100644 --- a/stackit/internal/services/postgresflex/instance/resource.go +++ b/stackit/internal/services/postgresflex/instance/resource.go @@ -66,8 +66,9 @@ type Model struct { BackupSchedule types.String `tfsdk:"backup_schedule"` ConnectionInfo types.Object `tfsdk:"connection_info"` // Deprecated: Flavor is deprecated and will be removed after February 2027. - Flavor types.Object `tfsdk:"flavor"` - FlavorId types.String `tfsdk:"flavor_id"` + Flavor types.Object `tfsdk:"flavor"` + FlavorId types.String `tfsdk:"flavor_id"` + // Deprecated: Replicas is deprecated and will be removed after February 2027. Replicas types.Int32 `tfsdk:"replicas"` Storage types.Object `tfsdk:"storage"` Encryption types.Object `tfsdk:"encryption"` @@ -261,7 +262,7 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, "connection_info.write.host": "The host of the instance.", "connection_info.write.port": "The port of the instance.", "replicas": "How many replicas the instance should have. Valid values are 1 for single mode or 3 for replication. Can only be set together with `flavor`", - "flavor_id": "The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available storage classes using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli):\n```bash\nstackit curl https://postgres-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\\?size=100\n```", + "flavor_id": "The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available flavors using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli):\n```bash\nstackit postgresflex flavor list\n```", "encryption.kek_key_id": "The ID of the Key within the STACKIT-KMS to use for the encryption.", "encryption.kek_keyring_id": "The ID of the keyring where the key is located within the STACKTI-KMS.", "encryption.kek_key_version": "Version of the key within the STACKIT-KMS to use for the encryption.", @@ -388,7 +389,7 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, "flavor": schema.SingleNestedAttribute{ Optional: true, Computed: true, - DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can get the available flavors using the STACKIT-CLI using `stackit curl https://postgres-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\\?size=100`.", + DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -451,9 +452,10 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, }, }, "replicas": schema.Int32Attribute{ - Description: descriptions["replicas"], - Optional: true, - Computed: true, + Description: descriptions["replicas"], + DeprecationMessage: "replicas is deprecated and will be removed after February 2027. Use instead `flavor_id` and choose a flavor with your wanted replica configuration. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", + Optional: true, + Computed: true, Validators: []validator.Int32{ int32validator.OneOf(1, 3), int32validator.AlsoRequires(path.Root("flavor").Expression()), From 6b57d66310343cb40c241b79425a2b6eae30018b Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Fri, 7 Aug 2026 11:43:16 +0200 Subject: [PATCH 2/3] review feedback --- docs/resources/postgresflex_instance.md | 7 ++----- .../internal/services/postgresflex/instance/resource.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/resources/postgresflex_instance.md b/docs/resources/postgresflex_instance.md index 27a4e64a2..768c4b7fe 100644 --- a/docs/resources/postgresflex_instance.md +++ b/docs/resources/postgresflex_instance.md @@ -46,10 +46,7 @@ resource "stackit_postgresflex_instance" "example" { - `acl` (List of String, Deprecated) The Access Control List (ACL) for the PostgresFlex instance. - `encryption` (Attributes) (see [below for nested schema](#nestedatt--encryption)) - `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor)) -- `flavor_id` (String) The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available flavors using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli): -```bash -stackit postgresflex flavor list -``` +- `flavor_id` (String) The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available flavors using the datasource `stackit_postgresflex_flavors` - `network` (Attributes) The network configuration of the instance. Will be required after February 2027. Set a value to prevent breaking changes. (see [below for nested schema](#nestedatt--network)) - `region` (String) The resource region. If not defined, the provider region is used. - `replicas` (Number, Deprecated) How many replicas the instance should have. Valid values are 1 for single mode or 3 for replication. Can only be set together with `flavor` @@ -68,7 +65,7 @@ Required: - `class` (String) The storage class. You can list available storage classes using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli): ```bash -stackit postgresflex options --storages --flavor-id FLAVOR_ID +stackit postgresflex flavor describe FLAVOR_ID ``` - `size` (Number) diff --git a/stackit/internal/services/postgresflex/instance/resource.go b/stackit/internal/services/postgresflex/instance/resource.go index b8e5b913d..0b50216dd 100644 --- a/stackit/internal/services/postgresflex/instance/resource.go +++ b/stackit/internal/services/postgresflex/instance/resource.go @@ -262,12 +262,12 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, "connection_info.write.host": "The host of the instance.", "connection_info.write.port": "The port of the instance.", "replicas": "How many replicas the instance should have. Valid values are 1 for single mode or 3 for replication. Can only be set together with `flavor`", - "flavor_id": "The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available flavors using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli):\n```bash\nstackit postgresflex flavor list\n```", + "flavor_id": "The flavor ID of the PostgreSQL Flex instance. Can only be set when `flavor` and `replicas` are not set. You can list available flavors using the datasource `stackit_postgresflex_flavors`", "encryption.kek_key_id": "The ID of the Key within the STACKIT-KMS to use for the encryption.", "encryption.kek_keyring_id": "The ID of the keyring where the key is located within the STACKTI-KMS.", "encryption.kek_key_version": "Version of the key within the STACKIT-KMS to use for the encryption.", "encryption.service_account": "Service-Account linked to the Key within the STACKIT-KMS.", - "storage_class": "The storage class. You can list available storage classes using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli):\n```bash\nstackit postgresflex options --storages --flavor-id FLAVOR_ID\n```", + "storage_class": "The storage class. You can list available storage classes using the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli):\n```bash\nstackit postgresflex flavor describe FLAVOR_ID\n```", "network": "The network configuration of the instance." + willBeRequired, "network.access_scope": "The network access scope of the instance. This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. " + utils.FormatPossibleValues(sdkUtils.EnumSliceToStringSlice(postgresflex.AllowedInstanceNetworkAccessScopeEnumValues)...), "network.acl": "List of IPV4 cidr." + willBeRequired, From 89d20c11a268fc8d88e00d29bc205fe178922555 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Fri, 7 Aug 2026 11:55:51 +0200 Subject: [PATCH 3/3] review feedback --- stackit/internal/services/postgresflex/instance/datasource.go | 4 ++-- stackit/internal/services/postgresflex/instance/resource.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stackit/internal/services/postgresflex/instance/datasource.go b/stackit/internal/services/postgresflex/instance/datasource.go index eb02561bf..a730334ab 100644 --- a/stackit/internal/services/postgresflex/instance/datasource.go +++ b/stackit/internal/services/postgresflex/instance/datasource.go @@ -138,7 +138,7 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques }, "flavor": schema.SingleNestedAttribute{ Computed: true, - DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", + DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can list available flavors using the datasource `stackit_postgresflex_flavors`..", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -180,7 +180,7 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques }, "replicas": schema.Int32Attribute{ Description: descriptions["replicas"], - DeprecationMessage: "replicas is deprecated and will be removed after February 2027. Use instead `flavor_id` and choose a flavor with your wanted replica configuration. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", + DeprecationMessage: "replicas is deprecated and will be removed after February 2027. Use instead `flavor_id` and choose a flavor with your wanted replica configuration. You can list available flavors using the datasource `stackit_postgresflex_flavors`.", Computed: true, }, "retention_days": schema.Int32Attribute{ diff --git a/stackit/internal/services/postgresflex/instance/resource.go b/stackit/internal/services/postgresflex/instance/resource.go index 0b50216dd..ccf219812 100644 --- a/stackit/internal/services/postgresflex/instance/resource.go +++ b/stackit/internal/services/postgresflex/instance/resource.go @@ -389,7 +389,7 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, "flavor": schema.SingleNestedAttribute{ Optional: true, Computed: true, - DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", + DeprecationMessage: "flavor is deprecated and will be removed after February 2027. Use instead `flavor_id`. You can list available flavors using the datasource `stackit_postgresflex_flavors`.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -453,7 +453,7 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, }, "replicas": schema.Int32Attribute{ Description: descriptions["replicas"], - DeprecationMessage: "replicas is deprecated and will be removed after February 2027. Use instead `flavor_id` and choose a flavor with your wanted replica configuration. You can get the available flavors using the STACKIT-CLI using `stackit postgresflex flavor list`.", + DeprecationMessage: "replicas is deprecated and will be removed after February 2027. Use instead `flavor_id` and choose a flavor with your wanted replica configuration. You can list available flavors using the datasource `stackit_postgresflex_flavors`.", Optional: true, Computed: true, Validators: []validator.Int32{