Skip to content

Commit db44fe3

Browse files
authored
fix(iaas): prevent state drift on server boot volume (#1347)
relates to STACKITTPR-609 and #1065
1 parent c9b7e44 commit db44fe3

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

stackit/internal/core/core.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import (
77
"strings"
88
"time"
99

10-
"github.com/hashicorp/terraform-plugin-framework/types"
11-
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
12-
1310
"github.com/hashicorp/terraform-plugin-framework/diag"
11+
"github.com/hashicorp/terraform-plugin-framework/types"
1412
"github.com/hashicorp/terraform-plugin-log/tflog"
13+
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
1514
)
1615

1716
type ResourceType string

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
1213
iaasUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/utils"
1314

1415
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
@@ -314,6 +315,9 @@ func (r *serverResource) Schema(_ context.Context, _ resource.SchemaRequest, res
314315
PlanModifiers: []planmodifier.String{
315316
stringplanmodifier.RequiresReplace(),
316317
},
318+
Validators: []validator.String{
319+
stringvalidator.OneOf(supportedSourceTypes...),
320+
},
317321
},
318322
"source_id": schema.StringAttribute{
319323
Description: "The ID of the source, either image ID or volume ID",
@@ -326,6 +330,7 @@ func (r *serverResource) Schema(_ context.Context, _ resource.SchemaRequest, res
326330
Description: "Delete the volume during the termination of the server. Only allowed when `source_type` is `image`.",
327331
Optional: true,
328332
Computed: true,
333+
Default: booldefault.StaticBool(false),
329334
PlanModifiers: []planmodifier.Bool{
330335
boolplanmodifier.RequiresReplace(),
331336
},

0 commit comments

Comments
 (0)