Skip to content

Commit c1b21e7

Browse files
authored
fix(instance): resource image with option public as a pointer on SDK-Go (#1692)
1 parent c033d99 commit c1b21e7

File tree

5 files changed

+1076
-2875
lines changed

5 files changed

+1076
-2875
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/hashicorp/terraform-plugin-log v0.7.0
1414
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
1515
github.com/robfig/cron/v3 v3.0.1
16-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221212155715-1af141c8883f
16+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.11
1717
github.com/stretchr/testify v1.8.1
1818
)
1919

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
227227
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
228228
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
229229
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
230-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221212155715-1af141c8883f h1:3wdSpuBw2nlULXpYgNsh2uii60adEuWdqP5QXHw5/m0=
231-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221212155715-1af141c8883f/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
230+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.11 h1:aBAUkfUmdpAs/7Yeq6T3inWFaKPxDmdkLMjbktx7qCs=
231+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.11/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
232232
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
233233
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
234234
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=

scaleway/resource_instance_image.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func resourceScalewayInstanceImageCreate(ctx context.Context, d *schema.Resource
183183
RootVolume: expandZonedID(d.Get("root_volume_id").(string)).ID,
184184
Arch: instance.Arch(d.Get("architecture").(string)),
185185
Project: expandStringPtr(d.Get("project_id")),
186-
Public: false,
186+
Public: expandBoolPtr(d.Get("public")),
187187
}
188188

189189
extraVolumesIds, volumesExist := d.GetOk("additional_volume_ids")
@@ -198,8 +198,8 @@ func resourceScalewayInstanceImageCreate(ctx context.Context, d *schema.Resource
198198
if tagsExist {
199199
req.Tags = expandStrings(tags)
200200
}
201-
if isPublic := d.Get("public"); isPublic == true {
202-
req.Public = true
201+
if _, exist := d.GetOk("public"); exist {
202+
req.Public = expandBoolPtr(getBool(d, "public"))
203203
}
204204

205205
res, err := instanceAPI.CreateImage(req, scw.WithContext(ctx))
@@ -275,7 +275,7 @@ func resourceScalewayInstanceImageUpdate(ctx context.Context, d *schema.Resource
275275
req.Arch = instance.Arch(d.Get("architecture").(string))
276276
}
277277
if d.HasChange("public") {
278-
req.Public = d.Get("public").(bool)
278+
req.Public = *expandBoolPtr(getBool(d, "public"))
279279
}
280280
req.Tags = expandUpdatedStringsPtr(d.Get("tags"))
281281

0 commit comments

Comments
 (0)