Skip to content

Commit 459122c

Browse files
authored
fix(utils): return updated ctx in SetAndLogStateFields func (#1100)
1 parent 6c39e50 commit 459122c

File tree

21 files changed

+29
-28
lines changed

21 files changed

+29
-28
lines changed

.github/docs/contribution-guide/resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (r *barResource) Create(ctx context.Context, req resource.CreateRequest, re
211211
// only in case the create bar API call is asynchronous (Make sure to include *ALL* fields which are part of the
212212
// internal terraform resource id! And please include the comment below in your code):
213213
// Write id attributes to state before polling via the wait handler - just in case anything goes wrong during the wait handler
214-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
214+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
215215
"project_id": projectId,
216216
"region": region,
217217
"bar_id": resp.BarId,
@@ -335,7 +335,7 @@ func (r *barResource) ImportState(ctx context.Context, req resource.ImportStateR
335335
return
336336
}
337337

338-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
338+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
339339
"project_id": idParts[0],
340340
"region": idParts[1],
341341
"bar_id": idParts[2],

stackit/internal/services/dns/recordset/resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (r *recordSetResource) Create(ctx context.Context, req resource.CreateReque
223223
ctx = core.LogResponse(ctx)
224224

225225
// Write id attributes to state before polling via the wait handler - just in case anything goes wrong during the wait handler
226-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
226+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
227227
"project_id": projectId,
228228
"zone_id": zoneId,
229229
"record_set_id": *recordSetResp.Rrset.Id,
@@ -399,7 +399,7 @@ func (r *recordSetResource) ImportState(ctx context.Context, req resource.Import
399399
return
400400
}
401401

402-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
402+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
403403
"project_id": idParts[0],
404404
"zone_id": idParts[1],
405405
"record_set_id": idParts[2],

stackit/internal/services/dns/zone/resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func (r *zoneResource) Create(ctx context.Context, req resource.CreateRequest, r
306306

307307
// Write id attributes to state before polling via the wait handler - just in case anything goes wrong during the wait handler
308308
zoneId := *createResp.Zone.Id
309-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
309+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
310310
"project_id": projectId,
311311
"zone_id": zoneId,
312312
})
@@ -477,7 +477,7 @@ func (r *zoneResource) ImportState(ctx context.Context, req resource.ImportState
477477
return
478478
}
479479

480-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
480+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
481481
"project_id": idParts[0],
482482
"zone_id": idParts[1],
483483
})

stackit/internal/services/iaas/affinitygroup/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (r *affinityGroupResource) ImportState(ctx context.Context, req resource.Im
325325
return
326326
}
327327

328-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
328+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
329329
"project_id": idParts[0],
330330
"region": idParts[1],
331331
"affinity_group_id": idParts[2],

stackit/internal/services/iaas/image/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ func (r *imageResource) ImportState(ctx context.Context, req resource.ImportStat
650650
return
651651
}
652652

653-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
653+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
654654
"project_id": idParts[0],
655655
"region": idParts[1],
656656
"image_id": idParts[2],

stackit/internal/services/iaas/networkarearegion/resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func (r *networkAreaRegionResource) Create(ctx context.Context, req resource.Cre
289289
ctx = core.LogResponse(ctx)
290290

291291
// Write id attributes to state before polling via the wait handler - just in case anything goes wrong during the wait handler
292-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
292+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
293293
"organization_id": organizationId,
294294
"network_area_id": networkAreaId,
295295
"region": region,
@@ -482,7 +482,7 @@ func (r *networkAreaRegionResource) ImportState(ctx context.Context, req resourc
482482
return
483483
}
484484

485-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
485+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
486486
"organization_id": idParts[0],
487487
"network_area_id": idParts[1],
488488
"region": idParts[2],

stackit/internal/services/iaas/networkarearoute/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ func (r *networkAreaRouteResource) ImportState(ctx context.Context, req resource
547547
return
548548
}
549549

550-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
550+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
551551
"organization_id": idParts[0],
552552
"network_area_id": idParts[1],
553553
"region": idParts[2],

stackit/internal/services/iaas/networkinterface/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func (r *networkInterfaceResource) ImportState(ctx context.Context, req resource
476476
return
477477
}
478478

479-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
479+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
480480
"project_id": idParts[0],
481481
"region": idParts[1],
482482
"network_id": idParts[2],

stackit/internal/services/iaas/networkinterfaceattach/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func (r *networkInterfaceAttachResource) ImportState(ctx context.Context, req re
317317
return
318318
}
319319

320-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
320+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]interface{}{
321321
"project_id": idParts[0],
322322
"region": idParts[1],
323323
"server_id": idParts[2],

stackit/internal/services/iaas/publicip/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ func (r *publicIpResource) ImportState(ctx context.Context, req resource.ImportS
374374
return
375375
}
376376

377-
utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
377+
ctx = utils.SetAndLogStateFields(ctx, &resp.Diagnostics, &resp.State, map[string]any{
378378
"project_id": idParts[0],
379379
"region": idParts[1],
380380
"public_ip_id": idParts[2],

0 commit comments

Comments
 (0)