From 2a3b09a5756d22022aa2af76025debcb8d7827e4 Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Tue, 20 Jan 2026 23:15:22 +0100 Subject: [PATCH] fix: do not require recreate if system-routes property is changed There is now an update mechanism for changing the "system_routes" property on routing tables. Therefore it does not need to be recreated but can be updated instead. --- stackit/internal/services/iaas/iaas_acc_test.go | 1 + .../internal/services/iaas/routingtable/table/resource.go | 5 +---- .../services/iaas/routingtable/table/resource_test.go | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stackit/internal/services/iaas/iaas_acc_test.go b/stackit/internal/services/iaas/iaas_acc_test.go index d9aaf7a1e..1d12bdb8a 100644 --- a/stackit/internal/services/iaas/iaas_acc_test.go +++ b/stackit/internal/services/iaas/iaas_acc_test.go @@ -593,6 +593,7 @@ var testConfigRoutingTableMaxUpdated = func() config.Variables { updatedConfig["name"] = config.StringVariable(fmt.Sprintf("acc-test-%s", acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum))) updatedConfig["description"] = config.StringVariable("This is the updated description of the routing table.") updatedConfig["label"] = config.StringVariable("routing-table-updated-label-01") + updatedConfig["system_routes"] = config.BoolVariable(true) updatedConfig["dynamic_routes"] = config.BoolVariable(true) return updatedConfig }() diff --git a/stackit/internal/services/iaas/routingtable/table/resource.go b/stackit/internal/services/iaas/routingtable/table/resource.go index d0e1328e9..f891a3839 100644 --- a/stackit/internal/services/iaas/routingtable/table/resource.go +++ b/stackit/internal/services/iaas/routingtable/table/resource.go @@ -8,7 +8,6 @@ import ( "time" "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier" "github.com/stackitcloud/stackit-sdk-go/services/iaas" iaasUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/utils" @@ -202,9 +201,6 @@ func (r *routingTableResource) Schema(_ context.Context, _ resource.SchemaReques Optional: true, Computed: true, Default: booldefault.StaticBool(true), - PlanModifiers: []planmodifier.Bool{ - boolplanmodifier.RequiresReplace(), - }, }, "dynamic_routes": schema.BoolAttribute{ Description: "This controls whether dynamic routes are propagated to this routing table", @@ -531,5 +527,6 @@ func toUpdatePayload(ctx context.Context, model *Model, currentLabels types.Map) Name: conversion.StringValueToPointer(model.Name), Labels: &labels, DynamicRoutes: conversion.BoolValueToPointer(model.DynamicRoutes), + SystemRoutes: conversion.BoolValueToPointer(model.SystemRoutes), }, nil } diff --git a/stackit/internal/services/iaas/routingtable/table/resource_test.go b/stackit/internal/services/iaas/routingtable/table/resource_test.go index 09997410e..2da1d999f 100644 --- a/stackit/internal/services/iaas/routingtable/table/resource_test.go +++ b/stackit/internal/services/iaas/routingtable/table/resource_test.go @@ -183,6 +183,7 @@ func TestToUpdatePayload(t *testing.T) { "key2": types.StringValue("value2"), }), DynamicRoutes: types.BoolValue(false), + SystemRoutes: types.BoolValue(false), }, &iaas.UpdateRoutingTableOfAreaPayload{ Description: utils.Ptr("Description"), @@ -192,6 +193,7 @@ func TestToUpdatePayload(t *testing.T) { "key2": "value2", }, DynamicRoutes: utils.Ptr(false), + SystemRoutes: utils.Ptr(false), }, true, },