From 4eab8fbbee596b99155931e12fb93de4244c25d3 Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Thu, 8 Jan 2026 12:21:47 +0100 Subject: [PATCH 1/8] feat: add dynamic_routes bool to routing_table Add the optional bool flag "dynamic_routes" to the routing_table resource. --- docs/data-sources/routing_table.md | 1 + docs/data-sources/routing_tables.md | 1 + docs/resources/routing_table.md | 1 + .../internal/services/iaas/iaas_acc_test.go | 3 ++ .../services/iaasalpha/iaasalpha_acc_test.go | 9 ++++ .../iaasalpha/routingtable/shared/shared.go | 7 +++ .../iaasalpha/routingtable/table/resource.go | 20 ++++++-- .../routingtable/table/resource_test.go | 6 ++- .../routingtable/tables/datasource.go | 1 + .../routingtable/tables/datasource_test.go | 48 +++++++++++-------- .../testdata/resource-routingtable-max.tf | 4 +- 11 files changed, 73 insertions(+), 28 deletions(-) diff --git a/docs/data-sources/routing_table.md b/docs/data-sources/routing_table.md index 680445693..cc9fcc00b 100644 --- a/docs/data-sources/routing_table.md +++ b/docs/data-sources/routing_table.md @@ -45,4 +45,5 @@ data "stackit_routing_table" "example" { - `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container - `name` (String) The name of the routing table. - `system_routes` (Boolean) This controls whether the routes for project-to-project communication are created automatically or not. +- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `updated_at` (String) Date-time when the routing table was updated diff --git a/docs/data-sources/routing_tables.md b/docs/data-sources/routing_tables.md index 26eac9c34..6caa42f87 100644 --- a/docs/data-sources/routing_tables.md +++ b/docs/data-sources/routing_tables.md @@ -51,4 +51,5 @@ Read-Only: - `name` (String) The name of the routing table. - `routing_table_id` (String) The routing tables ID. - `system_routes` (Boolean) This controls whether the routes for project-to-project communication are created automatically or not. +- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `updated_at` (String) Date-time when the routing table was updated diff --git a/docs/resources/routing_table.md b/docs/resources/routing_table.md index ff6e00e35..5fbef4252 100644 --- a/docs/resources/routing_table.md +++ b/docs/resources/routing_table.md @@ -47,6 +47,7 @@ import { - `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container - `region` (String) The resource region. If not defined, the provider region is used. - `system_routes` (Boolean) This controls whether the routes for project-to-project communication are created automatically or not. +- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table ### Read-Only diff --git a/stackit/internal/services/iaas/iaas_acc_test.go b/stackit/internal/services/iaas/iaas_acc_test.go index 58377f887..75f36f45c 100644 --- a/stackit/internal/services/iaas/iaas_acc_test.go +++ b/stackit/internal/services/iaas/iaas_acc_test.go @@ -719,6 +719,7 @@ func TestAccNetworkMax(t *testing.T) { resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "system_routes", "true"), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "updated_at"), ), @@ -803,6 +804,7 @@ func TestAccNetworkMax(t *testing.T) { resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("data.stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "system_routes", "true"), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "updated_at"), ), @@ -952,6 +954,7 @@ func TestAccNetworkMax(t *testing.T) { resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "system_routes", "true"), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "updated_at"), ), diff --git a/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go b/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go index dd0e06541..4fbca8f2e 100644 --- a/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go +++ b/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go @@ -62,6 +62,7 @@ var testConfigRoutingTableMax = config.Variables{ "description": config.StringVariable("This is the description of the routing table."), "label": config.StringVariable("routing-table-label-01"), "system_routes": config.BoolVariable(false), + "dynamic_routes": config.BoolVariable(false), "region": config.StringVariable(testutil.Region), } @@ -133,6 +134,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "system_routes", "true"), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "updated_at"), ), @@ -172,6 +174,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("data.stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "system_routes", "true"), + resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "default", "false"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "updated_at"), @@ -197,6 +200,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.labels.%", "0"), resource.TestCheckNoResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.description"), resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.system_routes", "true"), + resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.dynamic_routes", "true"), resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.default", "false"), resource.TestCheckResourceAttrSet("data.stackit_routing_tables.routing_tables", "items.1.created_at"), resource.TestCheckResourceAttrSet("data.stackit_routing_tables.routing_tables", "items.1.updated_at"), @@ -242,6 +246,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "system_routes", "true"), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "updated_at"), ), @@ -272,6 +277,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "region", testutil.ConvertConfigVariable(testConfigRoutingTableMax["region"])), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "description", testutil.ConvertConfigVariable(testConfigRoutingTableMax["description"])), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "system_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMax["system_routes"])), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMax["dynamic_routes"])), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "updated_at"), ), @@ -312,6 +318,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "region", testutil.ConvertConfigVariable(testConfigRoutingTableMax["region"])), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "description", testutil.ConvertConfigVariable(testConfigRoutingTableMax["description"])), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "system_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMax["system_routes"])), + resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "dynamic_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMax["dynamic_routes"])), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "default", "false"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "updated_at"), @@ -338,6 +345,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.labels.acc-test", testutil.ConvertConfigVariable(testConfigRoutingTableMax["label"])), resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.description", testutil.ConvertConfigVariable(testConfigRoutingTableMax["description"])), resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.system_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMax["system_routes"])), + resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.dynamic_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMax["dynamic_routes"])), resource.TestCheckResourceAttr("data.stackit_routing_tables.routing_tables", "items.1.default", "false"), resource.TestCheckResourceAttrSet("data.stackit_routing_tables.routing_tables", "items.1.created_at"), resource.TestCheckResourceAttrSet("data.stackit_routing_tables.routing_tables", "items.1.updated_at"), @@ -384,6 +392,7 @@ func TestAccRoutingTable(t *testing.T) { resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "region", testutil.ConvertConfigVariable(testConfigRoutingTableMaxUpdated["region"])), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "description", testutil.ConvertConfigVariable(testConfigRoutingTableMaxUpdated["description"])), resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "system_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMaxUpdated["system_routes"])), + resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", testutil.ConvertConfigVariable(testConfigRoutingTableMaxUpdated["dynamic_routes"])), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("stackit_routing_table.routing_table", "updated_at"), ), diff --git a/stackit/internal/services/iaasalpha/routingtable/shared/shared.go b/stackit/internal/services/iaasalpha/routingtable/shared/shared.go index 04382ad3e..3270f7905 100644 --- a/stackit/internal/services/iaasalpha/routingtable/shared/shared.go +++ b/stackit/internal/services/iaasalpha/routingtable/shared/shared.go @@ -26,6 +26,7 @@ type RoutingTableReadModel struct { UpdatedAt types.String `tfsdk:"updated_at"` Default types.Bool `tfsdk:"default"` SystemRoutes types.Bool `tfsdk:"system_routes"` + DynamicRoutes types.Bool `tfsdk:"dynamic_routes"` } func RoutingTableReadModelTypes() map[string]attr.Type { @@ -38,6 +39,7 @@ func RoutingTableReadModelTypes() map[string]attr.Type { "updated_at": types.StringType, "default": types.BoolType, "system_routes": types.BoolType, + "dynamic_routes": types.BoolType, } } @@ -208,6 +210,10 @@ func RoutingTableResponseAttributes() map[string]schema.Attribute { Description: "This controls whether the routes for project-to-project communication are created automatically or not.", Computed: true, }, + "dynamic_ro": schema.BoolAttribute{ + Description: "This controls whether the routes for project-to-project communication are created automatically or not.", + Computed: true, + }, "created_at": schema.StringAttribute{ Description: "Date-time when the routing table was created", Computed: true, @@ -257,6 +263,7 @@ func MapRoutingTableReadModel(ctx context.Context, routingTable *iaasalpha.Routi model.Description = types.StringPointerValue(routingTable.Description) model.Default = types.BoolPointerValue(routingTable.Default) model.SystemRoutes = types.BoolPointerValue(routingTable.SystemRoutes) + model.DynamicRoutes = types.BoolPointerValue(routingTable.DynamicRoutes) model.Labels = labels model.CreatedAt = createdAtTF model.UpdatedAt = updatedAtTF diff --git a/stackit/internal/services/iaasalpha/routingtable/table/resource.go b/stackit/internal/services/iaasalpha/routingtable/table/resource.go index 4b9fb1b06..da247697e 100644 --- a/stackit/internal/services/iaasalpha/routingtable/table/resource.go +++ b/stackit/internal/services/iaasalpha/routingtable/table/resource.go @@ -48,6 +48,7 @@ type Model struct { Labels types.Map `tfsdk:"labels"` Region types.String `tfsdk:"region"` SystemRoutes types.Bool `tfsdk:"system_routes"` + DynamicRoutes types.Bool `tfsdk:"dynamic_routes"` CreatedAt types.String `tfsdk:"created_at"` UpdatedAt types.String `tfsdk:"updated_at"` } @@ -206,6 +207,15 @@ func (r *routingTableResource) Schema(_ context.Context, _ resource.SchemaReques boolplanmodifier.RequiresReplace(), }, }, + "dynamic_routes": schema.BoolAttribute{ + Description: "This controls whether the routes for project-to-project communication are created automatically or not.", + Optional: true, + Computed: true, + Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ + boolplanmodifier.RequiresReplace(), + }, + }, "created_at": schema.StringAttribute{ Description: "Date-time when the routing table was created", Computed: true, @@ -485,6 +495,7 @@ func mapFields(ctx context.Context, routingTable *iaasalpha.RoutingTable, model model.Labels = labels model.Region = types.StringValue(region) model.SystemRoutes = types.BoolPointerValue(routingTable.SystemRoutes) + model.DynamicRoutes = types.BoolPointerValue(routingTable.DynamicRoutes) model.CreatedAt = createdAtTF model.UpdatedAt = updatedAtTF return nil @@ -501,10 +512,11 @@ func toCreatePayload(ctx context.Context, model *Model) (*iaasalpha.AddRoutingTa } return &iaasalpha.AddRoutingTableToAreaPayload{ - Description: conversion.StringValueToPointer(model.Description), - Name: conversion.StringValueToPointer(model.Name), - Labels: &labels, - SystemRoutes: conversion.BoolValueToPointer(model.SystemRoutes), + Description: conversion.StringValueToPointer(model.Description), + Name: conversion.StringValueToPointer(model.Name), + Labels: &labels, + SystemRoutes: conversion.BoolValueToPointer(model.SystemRoutes), + DynamicRoutes: conversion.BoolValueToPointer(model.DynamicRoutes), }, nil } diff --git a/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go b/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go index 24b1fef90..1f0bfbcfc 100644 --- a/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go +++ b/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go @@ -132,7 +132,8 @@ func TestToCreatePayload(t *testing.T) { Labels: types.MapValueMust(types.StringType, map[string]attr.Value{ "key": types.StringValue("value"), }), - SystemRoutes: types.BoolValue(true), + SystemRoutes: types.BoolValue(true), + DynamicRoutes: types.BoolValue(true), }, expected: &iaasalpha.AddRoutingTableToAreaPayload{ Description: utils.Ptr("Description"), @@ -140,7 +141,8 @@ func TestToCreatePayload(t *testing.T) { Labels: &map[string]interface{}{ "key": "value", }, - SystemRoutes: utils.Ptr(true), + SystemRoutes: utils.Ptr(true), + DynamicRoutes: utils.Ptr(true), }, isValid: true, }, diff --git a/stackit/internal/services/iaasalpha/routingtable/tables/datasource.go b/stackit/internal/services/iaasalpha/routingtable/tables/datasource.go index c6ef9268d..7ea6cbf25 100644 --- a/stackit/internal/services/iaasalpha/routingtable/tables/datasource.go +++ b/stackit/internal/services/iaasalpha/routingtable/tables/datasource.go @@ -196,6 +196,7 @@ func mapDataSourceRoutingTables(ctx context.Context, routingTables *iaasalpha.Ro "updated_at": routingTableModel.UpdatedAt, "default": routingTableModel.Default, "system_routes": routingTableModel.SystemRoutes, + "dynamic_routes": routingTableModel.DynamicRoutes, } routingTableTF, diags := types.ObjectValue(shared.RoutingTableReadModelTypes(), routingTableMap) diff --git a/stackit/internal/services/iaasalpha/routingtable/tables/datasource_test.go b/stackit/internal/services/iaasalpha/routingtable/tables/datasource_test.go index 2df93e796..9b6708e25 100644 --- a/stackit/internal/services/iaasalpha/routingtable/tables/datasource_test.go +++ b/stackit/internal/services/iaasalpha/routingtable/tables/datasource_test.go @@ -49,13 +49,14 @@ func TestMapDataFields(t *testing.T) { &iaasalpha.RoutingTableListResponse{ Items: &[]iaasalpha.RoutingTable{ { - Id: utils.Ptr(routingTableId.String()), - Name: utils.Ptr("test"), - Description: utils.Ptr("description"), - Default: utils.Ptr(true), - CreatedAt: &createdAt, - UpdatedAt: &updatedAt, - SystemRoutes: utils.Ptr(false), + Id: utils.Ptr(routingTableId.String()), + Name: utils.Ptr("test"), + Description: utils.Ptr("description"), + Default: utils.Ptr(true), + CreatedAt: &createdAt, + UpdatedAt: &updatedAt, + SystemRoutes: utils.Ptr(false), + DynamicRoutes: utils.Ptr(false), }, }, }, @@ -71,6 +72,7 @@ func TestMapDataFields(t *testing.T) { "description": types.StringValue("description"), "default": types.BoolValue(true), "system_routes": types.BoolValue(false), + "dynamic_routes": types.BoolValue(false), "created_at": types.StringValue(createdAt.Format(time.RFC3339)), "updated_at": types.StringValue(updatedAt.Format(time.RFC3339)), "labels": types.MapNull(types.StringType), @@ -89,22 +91,24 @@ func TestMapDataFields(t *testing.T) { &iaasalpha.RoutingTableListResponse{ Items: &[]iaasalpha.RoutingTable{ { - Id: utils.Ptr(routingTableId.String()), - Name: utils.Ptr("test"), - Description: utils.Ptr("description"), - Default: utils.Ptr(true), - CreatedAt: &createdAt, - UpdatedAt: &updatedAt, - SystemRoutes: utils.Ptr(false), + Id: utils.Ptr(routingTableId.String()), + Name: utils.Ptr("test"), + Description: utils.Ptr("description"), + Default: utils.Ptr(true), + CreatedAt: &createdAt, + UpdatedAt: &updatedAt, + SystemRoutes: utils.Ptr(false), + DynamicRoutes: utils.Ptr(false), }, { - Id: utils.Ptr(secondRoutingTableId.String()), - Name: utils.Ptr("test2"), - Description: utils.Ptr("description2"), - Default: utils.Ptr(false), - CreatedAt: &createdAt, - UpdatedAt: &updatedAt, - SystemRoutes: utils.Ptr(false), + Id: utils.Ptr(secondRoutingTableId.String()), + Name: utils.Ptr("test2"), + Description: utils.Ptr("description2"), + Default: utils.Ptr(false), + CreatedAt: &createdAt, + UpdatedAt: &updatedAt, + SystemRoutes: utils.Ptr(false), + DynamicRoutes: utils.Ptr(false), }, }, }, @@ -120,6 +124,7 @@ func TestMapDataFields(t *testing.T) { "description": types.StringValue("description"), "default": types.BoolValue(true), "system_routes": types.BoolValue(false), + "dynamic_routes": types.BoolValue(false), "created_at": types.StringValue(createdAt.Format(time.RFC3339)), "updated_at": types.StringValue(updatedAt.Format(time.RFC3339)), "labels": types.MapNull(types.StringType), @@ -130,6 +135,7 @@ func TestMapDataFields(t *testing.T) { "description": types.StringValue("description2"), "default": types.BoolValue(false), "system_routes": types.BoolValue(false), + "dynamic_routes": types.BoolValue(false), "created_at": types.StringValue(createdAt.Format(time.RFC3339)), "updated_at": types.StringValue(updatedAt.Format(time.RFC3339)), "labels": types.MapNull(types.StringType), diff --git a/stackit/internal/services/iaasalpha/testdata/resource-routingtable-max.tf b/stackit/internal/services/iaasalpha/testdata/resource-routingtable-max.tf index 74c656d13..f5e221144 100644 --- a/stackit/internal/services/iaasalpha/testdata/resource-routingtable-max.tf +++ b/stackit/internal/services/iaasalpha/testdata/resource-routingtable-max.tf @@ -5,6 +5,7 @@ variable "description" {} variable "region" {} variable "label" {} variable "system_routes" {} +variable "dynamic_routes" {} resource "stackit_routing_table" "routing_table" { organization_id = var.organization_id @@ -15,5 +16,6 @@ resource "stackit_routing_table" "routing_table" { labels = { "acc-test" : var.label } - system_routes = var.system_routes + system_routes = var.system_routes + dynamic_routes = var.dynamic_routes } From de7be125691f990d264add47788205dde3a49e22 Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Thu, 8 Jan 2026 13:01:02 +0100 Subject: [PATCH 2/8] fix: typo and adapt description --- .../internal/services/iaasalpha/routingtable/shared/shared.go | 4 ++-- .../services/iaasalpha/routingtable/table/resource.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stackit/internal/services/iaasalpha/routingtable/shared/shared.go b/stackit/internal/services/iaasalpha/routingtable/shared/shared.go index 3270f7905..dc3886ade 100644 --- a/stackit/internal/services/iaasalpha/routingtable/shared/shared.go +++ b/stackit/internal/services/iaasalpha/routingtable/shared/shared.go @@ -210,8 +210,8 @@ func RoutingTableResponseAttributes() map[string]schema.Attribute { Description: "This controls whether the routes for project-to-project communication are created automatically or not.", Computed: true, }, - "dynamic_ro": schema.BoolAttribute{ - Description: "This controls whether the routes for project-to-project communication are created automatically or not.", + "dynamic_routes": schema.BoolAttribute{ + Description: "This controls whether dynamic routes are propagated to this routing table", Computed: true, }, "created_at": schema.StringAttribute{ diff --git a/stackit/internal/services/iaasalpha/routingtable/table/resource.go b/stackit/internal/services/iaasalpha/routingtable/table/resource.go index da247697e..8557c28f3 100644 --- a/stackit/internal/services/iaasalpha/routingtable/table/resource.go +++ b/stackit/internal/services/iaasalpha/routingtable/table/resource.go @@ -208,7 +208,7 @@ func (r *routingTableResource) Schema(_ context.Context, _ resource.SchemaReques }, }, "dynamic_routes": schema.BoolAttribute{ - Description: "This controls whether the routes for project-to-project communication are created automatically or not.", + Description: "This controls whether dynamic routes are propagated to this routing table", Optional: true, Computed: true, Default: booldefault.StaticBool(true), From fe8f124017a2bb339d8303b5d46a0f50c31c7335 Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Thu, 8 Jan 2026 14:15:38 +0100 Subject: [PATCH 3/8] fix: bump iaasalpha to v0.1.23-alpha --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 424b1ea7d..9ededaff2 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.3 github.com/stackitcloud/stackit-sdk-go/services/git v0.10.1 github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.0 - github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.21-alpha + github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.23-alpha github.com/stackitcloud/stackit-sdk-go/services/kms v1.2.0 github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.6.2 github.com/stackitcloud/stackit-sdk-go/services/logme v0.25.3 diff --git a/go.sum b/go.sum index 7fc337865..ca8665c78 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,8 @@ github.com/stackitcloud/stackit-sdk-go/services/git v0.10.1 h1:3JKXfI5hdcXcRVBjU github.com/stackitcloud/stackit-sdk-go/services/git v0.10.1/go.mod h1:3nTaj8IGjNNGYUD2CpuXkXwc5c4giTUmoPggFhjVFxo= github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.0 h1:U/x0tc487X9msMS5yZYjrBAAKrCx87Trmt0kh8JiARA= github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.0/go.mod h1:6+5+RCDfU7eQN3+/SGdOtx7Bq9dEa2FrHz/jflgY1M4= -github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.21-alpha h1:m1jq6a8dbUe+suFuUNdHmM/cSehpGLUtDbK1CqLqydg= -github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.21-alpha/go.mod h1:Nu1b5Phsv8plgZ51+fkxPVsU91ZJ5Ayz+cthilxdmQ8= +github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.23-alpha h1:ugpMOMUZGB0yXsWcfe97F7GCdjlexbjFuGD8ZeyMSts= +github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.23-alpha/go.mod h1:v5VGvTxLcCdJJmblbhqYalt/MFHcElDfYoy15CMhaWs= github.com/stackitcloud/stackit-sdk-go/services/kms v1.2.0 h1:Ar2n9GKmrTN80G/Ta1R+fL5aX5nEoxL6ODVJl3emzho= github.com/stackitcloud/stackit-sdk-go/services/kms v1.2.0/go.mod h1:sHMFoYvVrkRZcH13DkLvp48nW+ssRVVVuwqJHDGpa5M= github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.6.2 h1:DwwRMzvnKWTbfmLvq2xe+mYhv5fA1AwWdQGznI05sGc= From c358562f848779d583b2cd38fe5589f093116c94 Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Thu, 8 Jan 2026 14:35:18 +0100 Subject: [PATCH 4/8] fix: docs --- docs/data-sources/routing_table.md | 2 +- docs/data-sources/routing_tables.md | 2 +- docs/resources/routing_table.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/data-sources/routing_table.md b/docs/data-sources/routing_table.md index cc9fcc00b..611f93113 100644 --- a/docs/data-sources/routing_table.md +++ b/docs/data-sources/routing_table.md @@ -41,9 +41,9 @@ data "stackit_routing_table" "example" { - `created_at` (String) Date-time when the routing table was created - `default` (Boolean) When true this is the default routing table for this network area. It can't be deleted and is used if the user does not specify it otherwise. - `description` (String) Description of the routing table. +- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `id` (String) Terraform's internal datasource ID. It is structured as "`organization_id`,`region`,`network_area_id`,`routing_table_id`". - `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container - `name` (String) The name of the routing table. - `system_routes` (Boolean) This controls whether the routes for project-to-project communication are created automatically or not. -- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `updated_at` (String) Date-time when the routing table was updated diff --git a/docs/data-sources/routing_tables.md b/docs/data-sources/routing_tables.md index 6caa42f87..338bb4cb6 100644 --- a/docs/data-sources/routing_tables.md +++ b/docs/data-sources/routing_tables.md @@ -47,9 +47,9 @@ Read-Only: - `created_at` (String) Date-time when the routing table was created - `default` (Boolean) When true this is the default routing table for this network area. It can't be deleted and is used if the user does not specify it otherwise. - `description` (String) Description of the routing table. +- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container - `name` (String) The name of the routing table. - `routing_table_id` (String) The routing tables ID. - `system_routes` (Boolean) This controls whether the routes for project-to-project communication are created automatically or not. -- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `updated_at` (String) Date-time when the routing table was updated diff --git a/docs/resources/routing_table.md b/docs/resources/routing_table.md index 5fbef4252..c0503705a 100644 --- a/docs/resources/routing_table.md +++ b/docs/resources/routing_table.md @@ -44,10 +44,10 @@ import { ### Optional - `description` (String) Description of the routing table. +- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table - `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container - `region` (String) The resource region. If not defined, the provider region is used. - `system_routes` (Boolean) This controls whether the routes for project-to-project communication are created automatically or not. -- `dynamic_routes` (Boolean) This controls whether dynamic routes are propagated to this routing table ### Read-Only From 7755a51c9a102d7886e941aae67ed8599b072f9b Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Thu, 8 Jan 2026 15:56:36 +0100 Subject: [PATCH 5/8] fix: allow change without recompute --- .../services/iaasalpha/routingtable/table/resource.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stackit/internal/services/iaasalpha/routingtable/table/resource.go b/stackit/internal/services/iaasalpha/routingtable/table/resource.go index 8557c28f3..b0b980a61 100644 --- a/stackit/internal/services/iaasalpha/routingtable/table/resource.go +++ b/stackit/internal/services/iaasalpha/routingtable/table/resource.go @@ -212,9 +212,6 @@ func (r *routingTableResource) Schema(_ context.Context, _ resource.SchemaReques Optional: true, Computed: true, Default: booldefault.StaticBool(true), - PlanModifiers: []planmodifier.Bool{ - boolplanmodifier.RequiresReplace(), - }, }, "created_at": schema.StringAttribute{ Description: "Date-time when the routing table was created", @@ -531,8 +528,9 @@ func toUpdatePayload(ctx context.Context, model *Model, currentLabels types.Map) } return &iaasalpha.UpdateRoutingTableOfAreaPayload{ - Description: conversion.StringValueToPointer(model.Description), - Name: conversion.StringValueToPointer(model.Name), - Labels: &labels, + Description: conversion.StringValueToPointer(model.Description), + Name: conversion.StringValueToPointer(model.Name), + Labels: &labels, + DynamicRoutes: conversion.BoolValueToPointer(model.DynamicRoutes), }, nil } From 132c0e7fb66498a1bedbd7bec984eba7368ceb6e Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Thu, 8 Jan 2026 17:05:46 +0100 Subject: [PATCH 6/8] fix: add unit-tests --- .../services/iaasalpha/routingtable/table/resource_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go b/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go index 1f0bfbcfc..52db3c99b 100644 --- a/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go +++ b/stackit/internal/services/iaasalpha/routingtable/table/resource_test.go @@ -182,6 +182,7 @@ func TestToUpdatePayload(t *testing.T) { "key1": types.StringValue("value1"), "key2": types.StringValue("value2"), }), + DynamicRoutes: types.BoolValue(false), }, &iaasalpha.UpdateRoutingTableOfAreaPayload{ Description: utils.Ptr("Description"), @@ -190,6 +191,7 @@ func TestToUpdatePayload(t *testing.T) { "key1": "value1", "key2": "value2", }, + DynamicRoutes: utils.Ptr(false), }, true, }, From c7aa7529ed72c92a40e6325a6f35222abd712921 Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Fri, 9 Jan 2026 14:01:34 +0100 Subject: [PATCH 7/8] fix: check for data instead of resource --- stackit/internal/services/iaas/iaas_acc_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stackit/internal/services/iaas/iaas_acc_test.go b/stackit/internal/services/iaas/iaas_acc_test.go index 75f36f45c..74a7dc909 100644 --- a/stackit/internal/services/iaas/iaas_acc_test.go +++ b/stackit/internal/services/iaas/iaas_acc_test.go @@ -804,7 +804,7 @@ func TestAccNetworkMax(t *testing.T) { resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "region", testutil.Region), resource.TestCheckNoResourceAttr("data.stackit_routing_table.routing_table", "description"), resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "system_routes", "true"), - resource.TestCheckResourceAttr("stackit_routing_table.routing_table", "dynamic_routes", "true"), + resource.TestCheckResourceAttr("data.stackit_routing_table.routing_table", "dynamic_routes", "true"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "created_at"), resource.TestCheckResourceAttrSet("data.stackit_routing_table.routing_table", "updated_at"), ), From f1e2e618d1e3dde52879c13b3a127c41fd1cd2ae Mon Sep 17 00:00:00 2001 From: Jonas Gottlieb Date: Mon, 12 Jan 2026 11:25:57 +0100 Subject: [PATCH 8/8] fix: add add-test update case --- stackit/internal/services/iaasalpha/iaasalpha_acc_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go b/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go index 4fbca8f2e..a8c21ff4b 100644 --- a/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go +++ b/stackit/internal/services/iaasalpha/iaasalpha_acc_test.go @@ -74,6 +74,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["dynamic_routes"] = config.BoolVariable(true) return updatedConfig }()