Skip to content

Commit 635a523

Browse files
committed
fix(iaas): persist partial state during apply of network area resource
1 parent 459122c commit 635a523

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

stackit/internal/services/iaas/networkarea/resource.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ func (r *networkAreaResource) Create(ctx context.Context, req resource.CreateReq
332332
return
333333
}
334334

335+
// persist state - just in case anything goes wrong while creating the network area region
336+
resp.Diagnostics.Append(resp.State.Set(ctx, model)...)
337+
if resp.Diagnostics.HasError() {
338+
return
339+
}
340+
335341
// Deprecated: Will be removed in May 2026. Only introduced to make the IaaS v1 -> v2 API migration non-breaking in the Terraform provider.
336342
if model.LegacyMode() {
337343
core.LogAndAddWarning(ctx, &resp.Diagnostics, deprecationWarningSummary, deprecationWarningDetails)
@@ -524,6 +530,12 @@ func (r *networkAreaResource) Update(ctx context.Context, req resource.UpdateReq
524530
return
525531
}
526532

533+
// persist state - just in case anything goes wrong while updating the network area region
534+
resp.Diagnostics.Append(resp.State.Set(ctx, model)...)
535+
if resp.Diagnostics.HasError() {
536+
return
537+
}
538+
527539
// Deprecated: Will be removed in May 2026. Only introduced to make the IaaS v1 -> v2 API migration non-breaking in the Terraform provider.
528540
if model.LegacyMode() {
529541
core.LogAndAddWarning(ctx, &resp.Diagnostics, deprecationWarningSummary, deprecationWarningDetails)

0 commit comments

Comments
 (0)