From 00a43dfb4c29b749f129aa197ec8777a0c6b1c22 Mon Sep 17 00:00:00 2001 From: "Marcel S. Henselin" Date: Tue, 10 Feb 2026 12:25:19 +0000 Subject: [PATCH] fix: fix wrong identity handling in Read (#41) ## Description relates to #1234 ## Checklist - [ ] Issue was linked above - [ ] Code format was applied: `make fmt` - [ ] Examples were added / adjusted (see `examples/` directory) - [x] Docs are up-to-date: `make generate-docs` (will be checked by CI) - [ ] Unit tests got implemented or updated - [ ] Acceptance tests got implemented or updated (see e.g. [here](https://github.com/stackitcloud/terraform-provider-stackit/blob/f5f99d170996b208672ae684b6da53420e369563/stackit/internal/services/dns/dns_acc_test.go)) - [x] Unit tests are passing: `make test` (will be checked by CI) - [x] No linter issues: `make lint` (will be checked by CI) Reviewed-on: https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pulls/41 Co-authored-by: Marcel S. Henselin Co-committed-by: Marcel S. Henselin --- .../postgresflexalpha/instance/resource.go | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/stackit/internal/services/postgresflexalpha/instance/resource.go b/stackit/internal/services/postgresflexalpha/instance/resource.go index 78bb0572..3d603df0 100644 --- a/stackit/internal/services/postgresflexalpha/instance/resource.go +++ b/stackit/internal/services/postgresflexalpha/instance/resource.go @@ -324,13 +324,6 @@ func (r *instanceResource) Read( return } - // Read identity data - var identityData InstanceResourceIdentityModel - resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...) - if resp.Diagnostics.HasError() { - return - } - ctx = core.InitProviderContext(ctx) // projectId := model.ProjectId.ValueString() @@ -340,34 +333,16 @@ func (r *instanceResource) Read( var projectId string if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() { projectId = model.ProjectId.ValueString() - } else { - if identityData.ProjectID.IsNull() || identityData.ProjectID.IsUnknown() { - core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "project_id not found in config") - return - } - projectId = identityData.ProjectID.ValueString() } var region string if !model.Region.IsNull() && !model.Region.IsUnknown() { region = r.providerData.GetRegionWithOverride(model.Region) - } else { - if identityData.Region.IsNull() || identityData.Region.IsUnknown() { - core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "region not found in config") - return - } - region = r.providerData.GetRegionWithOverride(identityData.Region) } var instanceId string if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() { instanceId = model.InstanceId.ValueString() - } else { - if identityData.InstanceID.IsNull() || identityData.InstanceID.IsUnknown() { - core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "instance_id not found in config") - return - } - instanceId = identityData.InstanceID.ValueString() } ctx = tflog.SetField(ctx, "project_id", projectId)