Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stackit/internal/services/iaas/iaas_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also adjust the Acc tests to ensure there's a update triggered and no replace:

ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("stackit_kms_keyring.keyring", plancheck.ResourceActionNoop),
},
},

ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("stackit_kms_keyring.keyring", plancheck.ResourceActionReplace),
},
},

This can be done using the plancheck package, the KMS acc test is a great example for it 😅

updatedConfig["dynamic_routes"] = config.BoolVariable(true)
return updatedConfig
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -192,6 +193,7 @@ func TestToUpdatePayload(t *testing.T) {
"key2": "value2",
},
DynamicRoutes: utils.Ptr(false),
SystemRoutes: utils.Ptr(false),
},
true,
},
Expand Down
Loading