From 6f99f16d0d3061881d10cb8438ca606cc8fbda82 Mon Sep 17 00:00:00 2001 From: Jonas Schlecht Date: Thu, 30 Jul 2026 11:35:40 +0200 Subject: [PATCH 1/3] fix(postgresflex): fix state drift seen when migrating from v2 to v3 --- docs/resources/postgresflex_instance.md | 2 +- .../services/postgresflex/instance/resource.go | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/docs/resources/postgresflex_instance.md b/docs/resources/postgresflex_instance.md index e8786c8ca..e00b5d0ab 100644 --- a/docs/resources/postgresflex_instance.md +++ b/docs/resources/postgresflex_instance.md @@ -45,7 +45,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) (see [below for nested schema](#nestedatt--flavor)) +- `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): ```bash stackit postgresflex options --flavors diff --git a/stackit/internal/services/postgresflex/instance/resource.go b/stackit/internal/services/postgresflex/instance/resource.go index be2f3a92a..264b5c048 100644 --- a/stackit/internal/services/postgresflex/instance/resource.go +++ b/stackit/internal/services/postgresflex/instance/resource.go @@ -28,7 +28,6 @@ import ( postgresflexUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/postgresflex/utils" "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils" "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils/planmodifiers/listplanmodifier" - stringplanmodifier2 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils/planmodifiers/stringplanmodifier" "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -386,22 +385,15 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, }, }, "flavor": schema.SingleNestedAttribute{ - Optional: true, - Computed: true, + 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`.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - stringplanmodifier2.UseStateForUnknownIf(stringplanmodifier2.StringUnchanged(path.Root("flavor_id")), "sets `UseStateForUnknown` if `flavor_id` remains unchanged"), - }, }, "description": schema.StringAttribute{ Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - stringplanmodifier2.UseStateForUnknownIf(stringplanmodifier2.StringUnchanged(path.Root("flavor_id")), "sets `UseStateForUnknown` if `flavor_id` remains unchanged"), - }, }, "cpu": schema.Int64Attribute{ Required: true, @@ -411,10 +403,6 @@ func (r *instanceResource) Schema(_ context.Context, req resource.SchemaRequest, }, "node_type": schema.StringAttribute{ Computed: true, - PlanModifiers: []planmodifier.String{ - UseStateForUnknownIfFlavorUnchanged(req), - stringplanmodifier2.UseStateForUnknownIf(stringplanmodifier2.StringUnchanged(path.Root("flavor_id")), "sets `UseStateForUnknown` if `flavor_id` remains unchanged"), - }, }, }, Validators: []validator.Object{ From c17947f9122031ba0e994a848188f232d286a78d Mon Sep 17 00:00:00 2001 From: Jonas Schlecht Date: Thu, 30 Jul 2026 13:37:09 +0200 Subject: [PATCH 2/3] docs(postgresflex): update flavors command --- docs/resources/postgresflex_instance.md | 2 +- stackit/internal/services/postgresflex/instance/resource.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/resources/postgresflex_instance.md b/docs/resources/postgresflex_instance.md index e00b5d0ab..c96e6dcb7 100644 --- a/docs/resources/postgresflex_instance.md +++ b/docs/resources/postgresflex_instance.md @@ -48,7 +48,7 @@ resource "stackit_postgresflex_instance" "example" { - `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): ```bash -stackit postgresflex options --flavors +stackit curl https://postgres-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\?size=100 ``` - `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. diff --git a/stackit/internal/services/postgresflex/instance/resource.go b/stackit/internal/services/postgresflex/instance/resource.go index 264b5c048..dd94dd2a5 100644 --- a/stackit/internal/services/postgresflex/instance/resource.go +++ b/stackit/internal/services/postgresflex/instance/resource.go @@ -260,7 +260,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 postgresflex options --flavors\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 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```", "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.", @@ -387,7 +387,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 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`.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, From 46840ae30213022be13d059b2de64089e5ffa4bb Mon Sep 17 00:00:00 2001 From: Jonas Schlecht Date: Thu, 30 Jul 2026 13:51:17 +0200 Subject: [PATCH 3/3] fix(sqlserver): fix state drift seen when migrating from v2 to v3 --- docs/resources/sqlserverflex_instance.md | 7 +++++-- .../services/sqlserverflex/instance/resource.go | 13 ++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/resources/sqlserverflex_instance.md b/docs/resources/sqlserverflex_instance.md index 06bfdac1b..cb9502e83 100644 --- a/docs/resources/sqlserverflex_instance.md +++ b/docs/resources/sqlserverflex_instance.md @@ -43,8 +43,11 @@ resource "stackit_sqlserverflex_instance" "example" { - `acl` (List of String, Deprecated) The Access Control List (ACL) for the SQLServer Flex instance. - `backup_schedule` (String) The backup schedule. Should follow the cron scheduling system format (e.g. "0 0 * * *") Will be required in the future. Set a value to prevent breaking changes. - `encryption` (Attributes) Parameter to define which key to use for storage encryption. (see [below for nested schema](#nestedatt--encryption)) -- `flavor` (Attributes) (see [below for nested schema](#nestedatt--flavor)) -- `flavor_id` (String) The flavor ID of the SQLServer Flex instance. +- `flavor` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--flavor)) +- `flavor_id` (String) The flavor ID of the sqlserver 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): +```bash +stackit curl https://mssql-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\?size=100 +``` - `network` (Attributes) The network configuration of the instance. Will be required in the future. Set a value to prevent breaking changes. (see [below for nested schema](#nestedatt--network)) - `options` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--options)) - `region` (String) The resource region. If not defined, the provider region is used. diff --git a/stackit/internal/services/sqlserverflex/instance/resource.go b/stackit/internal/services/sqlserverflex/instance/resource.go index 210b75a39..2b1ade3f2 100644 --- a/stackit/internal/services/sqlserverflex/instance/resource.go +++ b/stackit/internal/services/sqlserverflex/instance/resource.go @@ -327,7 +327,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r "kek_key_version": "Version of the key within the STACKIT-KMS to use for the encryption.", "service_account": "Service-Account linked to the Key within the STACKIT-KMS.", "options": "Custom parameters for the SQLServer Flex instance.", - "flavor_id": "The flavor ID of the SQLServer Flex instance.", + "flavor_id": "The flavor ID of the sqlserver 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://mssql-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\\?size=100\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.", "network.acl": "List of IPV4 cidr." + willBeRequired, @@ -455,20 +455,15 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r }, }, "flavor": schema.SingleNestedAttribute{ - Computed: true, - Optional: true, + Computed: true, + Optional: 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://mssql-flex-service.api.stackit.cloud/v3/projects/{project_id}/regions/{region}/flavors\\?size=100`.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, }, "description": schema.StringAttribute{ Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, }, "cpu": schema.Int64Attribute{ Required: true,