Skip to content

Commit 593ddff

Browse files
authored
fix: force update empty list if a string list has been updated to an empty list (#1333)
1 parent 171aeb9 commit 593ddff

8 files changed

+12
-15
lines changed

scaleway/resource_baremetal_server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func resourceScalewayBaremetalServerUpdate(ctx context.Context, d *schema.Resour
233233
ServerID: zonedID.ID,
234234
Name: expandStringPtr(d.Get("name")),
235235
Description: expandStringPtr(d.Get("description")),
236-
Tags: scw.StringsPtr(expandStrings(d.Get("tags"))),
236+
Tags: expandUpdatedStringsPtr(d.Get("tags")),
237237
}, scw.WithContext(ctx))
238238
if err != nil {
239239
return diag.FromErr(err)

scaleway/resource_instance_ip.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func resourceScalewayInstanceIPUpdate(ctx context.Context, d *schema.ResourceDat
100100
}
101101

102102
if d.HasChange("tags") {
103-
req.Tags = scw.StringsPtr(expandStrings(d.Get("tags")))
103+
req.Tags = expandUpdatedStringsPtr(d.Get("tags"))
104104
}
105105

106106
_, err = instanceAPI.UpdateIP(req, scw.WithContext(ctx))

scaleway/resource_instance_placement_group.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ func resourceScalewayInstancePlacementGroupUpdate(ctx context.Context, d *schema
153153
}
154154

155155
if d.HasChange("tags") {
156-
if len(expandStrings(d.Get("tags"))) > 0 {
157-
req.Tags = scw.StringsPtr(expandStrings(d.Get("tags")))
158-
}
156+
req.Tags = expandUpdatedStringsPtr(d.Get("tags"))
159157
hasChanged = true
160158
}
161159

scaleway/resource_instance_server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ func resourceScalewayInstanceServerUpdate(ctx context.Context, d *schema.Resourc
661661
}
662662

663663
if d.HasChange("tags") {
664-
updateRequest.Tags = scw.StringsPtr(expandStrings(d.Get("tags")))
664+
updateRequest.Tags = expandUpdatedStringsPtr(d.Get("tags"))
665665
}
666666

667667
if d.HasChange("security_group_id") {

scaleway/resource_k8s_cluster.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -513,20 +513,19 @@ func resourceScalewayK8SClusterUpdate(ctx context.Context, d *schema.ResourceDat
513513
}
514514

515515
if d.HasChange("tags") {
516-
tags := expandStrings(d.Get("tags"))
517-
updateRequest.Tags = scw.StringsPtr(tags)
516+
updateRequest.Tags = expandUpdatedStringsPtr(d.Get("tags"))
518517
}
519518

520519
if d.HasChange("apiserver_cert_sans") {
521-
updateRequest.ApiserverCertSans = scw.StringsPtr(expandStrings(d.Get("apiserver_cert_sans")))
520+
updateRequest.ApiserverCertSans = expandUpdatedStringsPtr(d.Get("apiserver_cert_sans"))
522521
}
523522

524523
if d.HasChange("feature_gates") {
525-
updateRequest.FeatureGates = scw.StringsPtr(expandStrings(d.Get("feature_gates")))
524+
updateRequest.FeatureGates = expandUpdatedStringsPtr(d.Get("feature_gates"))
526525
}
527526

528527
if d.HasChange("admission_plugins") {
529-
updateRequest.AdmissionPlugins = scw.StringsPtr(expandStrings(d.Get("admission_plugins")))
528+
updateRequest.AdmissionPlugins = expandUpdatedStringsPtr(d.Get("admission_plugins"))
530529
}
531530

532531
updateRequest.AutoUpgrade = &k8s.UpdateClusterRequestAutoUpgrade{}

scaleway/resource_k8s_pool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ func resourceScalewayK8SPoolUpdate(ctx context.Context, d *schema.ResourceData,
388388
}
389389

390390
if d.HasChange("tags") {
391-
updateRequest.Tags = scw.StringsPtr(expandStrings(d.Get("tags")))
391+
updateRequest.Tags = expandUpdatedStringsPtr(d.Get("tags"))
392392
}
393393

394394
if d.HasChange("kubelet_args") {

scaleway/resource_rdb_instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ func resourceScalewayRdbInstanceUpdate(ctx context.Context, d *schema.ResourceDa
471471
req.BackupSameRegion = expandBoolPtr(d.Get("backup_same_region"))
472472
}
473473
if d.HasChange("tags") {
474-
req.Tags = scw.StringsPtr(expandStrings(d.Get("tags")))
474+
req.Tags = expandUpdatedStringsPtr(d.Get("tags"))
475475
}
476476

477477
_, err = waitForRDBInstance(ctx, rdbAPI, region, ID, d.Timeout(schema.TimeoutUpdate))

scaleway/resource_vpc_public_gateway.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func resourceScalewayVPCPublicGatewayUpdate(ctx context.Context, d *schema.Resou
183183
}
184184

185185
if d.HasChange("tags") {
186-
updateRequest.Tags = scw.StringsPtr(expandStrings(d.Get("tags")))
186+
updateRequest.Tags = expandUpdatedStringsPtr(d.Get("tags"))
187187
}
188188

189189
if d.HasChange("bastion_port") {
@@ -195,7 +195,7 @@ func resourceScalewayVPCPublicGatewayUpdate(ctx context.Context, d *schema.Resou
195195
}
196196

197197
if d.HasChange("upstream_dns_servers") {
198-
updateRequest.UpstreamDNSServers = scw.StringsPtr(expandStrings(d.Get("upstream_dns_servers")))
198+
updateRequest.UpstreamDNSServers = expandUpdatedStringsPtr(d.Get("upstream_dns_servers"))
199199
}
200200

201201
_, err = vpcgwAPI.UpdateGateway(updateRequest, scw.WithContext(ctx))

0 commit comments

Comments
 (0)