Skip to content
Merged
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/nats-io/jwt/v2 v2.7.0
github.com/nats-io/nats.go v1.37.0
github.com/robfig/cron/v3 v3.0.1
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241016121547-71e46305b9a0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241018083319-8ca184d21821
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.27.0
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXq
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241016121547-71e46305b9a0 h1:bykODWS911XOzQZ+WfJ2NmWmFcB0Iuod5+brNIUeNqE=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241016121547-71e46305b9a0/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241018083319-8ca184d21821 h1:lUig6xEMWR3vL7jAw0rX8XfCVyrcE11lOfh85TR4jgU=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241018083319-8ca184d21821/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
Expand Down
7 changes: 5 additions & 2 deletions internal/services/instance/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,17 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m
Zone: zone,
Name: types.ExpandOrGenerateString(d.Get("name"), "srv"),
Project: types.ExpandStringPtr(d.Get("project_id")),
Image: imageUUID,
CommercialType: commercialType,
SecurityGroup: types.ExpandStringPtr(zonal.ExpandID(d.Get("security_group_id")).ID),
DynamicIPRequired: scw.BoolPtr(d.Get("enable_dynamic_ip").(bool)),
Tags: types.ExpandStrings(d.Get("tags")),
RoutedIPEnabled: types.ExpandBoolPtr(types.GetBool(d, "routed_ip_enabled")),
}

if imageUUID != "" {
req.Image = scw.StringPtr(imageUUID)
}

enableIPv6, ok := d.GetOk("enable_ipv6")
if ok {
req.EnableIPv6 = scw.BoolPtr(enableIPv6.(bool)) //nolint:staticcheck
Expand Down Expand Up @@ -453,7 +456,7 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m
req.Volumes = make(map[string]*instanceSDK.VolumeServerTemplate)
rootVolume := d.Get("root_volume.0").(map[string]any)

req.Volumes["0"] = prepareRootVolume(rootVolume, serverType, req.Image).VolumeTemplate()
req.Volumes["0"] = prepareRootVolume(rootVolume, serverType, imageUUID).VolumeTemplate()
if raw, ok := d.GetOk("additional_volume_ids"); ok {
for i, volumeID := range raw.([]interface{}) {
// We have to get the volume to know whether it is a local or a block volume
Expand Down
Loading