@@ -379,32 +379,32 @@ func ResourceServerCreate(ctx context.Context, d *schema.ResourceData, m any) di
379379 req .UserData = & cloudInitStr
380380 }
381381
382- partitioningSchema := baremetal.Schema {}
383-
384382 if file , ok := d .GetOk ("partitioning" ); ok || ! d .Get ("install_config_afterward" ).(bool ) {
385383 if diags := validateInstallConfig (ctx , d , m ); len (diags ) > 0 {
386384 return diags
387385 }
388386
389- if file != "" {
390- todecode , _ := file .(string )
391-
392- err = json .Unmarshal ([]byte (todecode ), & partitioningSchema )
393- if err != nil {
394- return diag .FromErr (err )
395- }
396- }
397-
398387 req .Install = & baremetal.CreateServerRequestInstall {
399388 OsID : zonal .ExpandID (d .Get ("os" )).ID ,
400389 Hostname : d .Get ("hostname" ).(string ),
401390 SSHKeyIDs : types .ExpandStrings (d .Get ("ssh_key_ids" )),
402391 User : types .ExpandStringPtr (d .Get ("user" )),
403392 Password : types .ExpandStringPtr (d .Get ("password" )),
404- PartitioningSchema : & partitioningSchema ,
393+ PartitioningSchema : nil ,
405394 ServicePassword : types .ExpandStringPtr (d .Get ("service_password" )),
406395 ServiceUser : types .ExpandStringPtr (d .Get ("service_user" )),
407396 }
397+
398+ partitioningSchema := baremetal.Schema {}
399+ if file != "" {
400+ todecode , _ := file .(string )
401+
402+ err = json .Unmarshal ([]byte (todecode ), & partitioningSchema )
403+ if err != nil {
404+ return diag .FromErr (err )
405+ }
406+ req .Install .PartitioningSchema = & partitioningSchema
407+ }
408408 }
409409
410410 server , err := api .CreateServer (req , scw .WithContext (ctx ))
0 commit comments