@@ -410,14 +410,17 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m
410410 Zone : zone ,
411411 Name : types .ExpandOrGenerateString (d .Get ("name" ), "srv" ),
412412 Project : types .ExpandStringPtr (d .Get ("project_id" )),
413- Image : imageUUID ,
414413 CommercialType : commercialType ,
415414 SecurityGroup : types .ExpandStringPtr (zonal .ExpandID (d .Get ("security_group_id" )).ID ),
416415 DynamicIPRequired : scw .BoolPtr (d .Get ("enable_dynamic_ip" ).(bool )),
417416 Tags : types .ExpandStrings (d .Get ("tags" )),
418417 RoutedIPEnabled : types .ExpandBoolPtr (types .GetBool (d , "routed_ip_enabled" )),
419418 }
420419
420+ if imageUUID != "" {
421+ req .Image = scw .StringPtr (imageUUID )
422+ }
423+
421424 enableIPv6 , ok := d .GetOk ("enable_ipv6" )
422425 if ok {
423426 req .EnableIPv6 = scw .BoolPtr (enableIPv6 .(bool )) //nolint:staticcheck
@@ -453,7 +456,7 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m
453456 req .Volumes = make (map [string ]* instanceSDK.VolumeServerTemplate )
454457 rootVolume := d .Get ("root_volume.0" ).(map [string ]any )
455458
456- req .Volumes ["0" ] = prepareRootVolume (rootVolume , serverType , req . Image ).VolumeTemplate ()
459+ req .Volumes ["0" ] = prepareRootVolume (rootVolume , serverType , imageUUID ).VolumeTemplate ()
457460 if raw , ok := d .GetOk ("additional_volume_ids" ); ok {
458461 for i , volumeID := range raw .([]interface {}) {
459462 // We have to get the volume to know whether it is a local or a block volume
0 commit comments