Skip to content

Commit 526c83d

Browse files
authored
feat(instance): prevent explicit b_ssd usage for instance_server root_volume (#2951)
1 parent cc21f51 commit 526c83d

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

internal/services/instance/server.go

+18-6
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,24 @@ func ResourceServer() *schema.Resource {
125125
Description: "Size of the root volume in gigabytes",
126126
},
127127
"volume_type": {
128-
Type: schema.TypeString,
129-
Optional: true,
130-
Computed: true,
131-
ForceNew: true,
132-
Description: "Volume type of the root volume",
133-
ValidateDiagFunc: verify.ValidateEnum[instanceSDK.VolumeVolumeType](),
128+
Type: schema.TypeString,
129+
Optional: true,
130+
Computed: true,
131+
ForceNew: true,
132+
Description: "Volume type of the root volume",
133+
ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics {
134+
diags := verify.ValidateEnum[instanceSDK.VolumeVolumeType]()(i, path)
135+
if i.(string) == "b_ssd" {
136+
diags = append(diags, diag.Diagnostic{
137+
Severity: diag.Error,
138+
Summary: "b_ssd volumes are not supported anymore",
139+
Detail: "Remove explicit b_ssd volume_type, migrate to sbs or downgrade terraform.\nLearn more about migration: https://www.scaleway.com/en/docs/instances/how-to/migrate-volumes-snapshots-to-sbs/",
140+
AttributePath: path,
141+
})
142+
}
143+
144+
return diags
145+
},
134146
},
135147
"delete_on_termination": {
136148
Type: schema.TypeBool,

0 commit comments

Comments
 (0)