Skip to content

Commit 8d2687a

Browse files
committed
transferSubGroup function returns error instead of Diagnostics
1 parent 7f9374a commit 8d2687a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/provider/resource_gitlab_group.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,20 +369,20 @@ func resourceGitlabGroupUpdate(ctx context.Context, d *schema.ResourceData, meta
369369
}
370370

371371
if d.HasChange("parent_id") {
372-
diagnostic := transferSubGroup(ctx, d, client)
373-
if diagnostic.HasError() {
374-
return diagnostic
372+
err = transferSubGroup(ctx, d, client)
373+
if err != nil {
374+
return diag.FromErr(err)
375375
}
376376
}
377377

378378
return resourceGitlabGroupRead(ctx, d, meta)
379379
}
380380

381-
func transferSubGroup(ctx context.Context, d *schema.ResourceData, client *gitlab.Client) diag.Diagnostics {
381+
func transferSubGroup(ctx context.Context, d *schema.ResourceData, client *gitlab.Client) error {
382382
o, n := d.GetChange("parent_id")
383383
parentId, ok := n.(int)
384384
if !ok {
385-
return diag.Errorf("error converting parent_id %v into an int", n)
385+
return fmt.Errorf("error converting parent_id %v into an int", n)
386386
}
387387

388388
opt := &gitlab.TransferSubGroupOptions{}
@@ -395,7 +395,7 @@ func transferSubGroup(ctx context.Context, d *schema.ResourceData, client *gitla
395395

396396
_, _, err := client.Groups.TransferSubGroup(d.Id(), opt, gitlab.WithContext(ctx))
397397
if err != nil {
398-
return diag.Errorf("error transfering group %s to new parent group %v: %s", d.Id(), parentId, err)
398+
return fmt.Errorf("error transfering group %s to new parent group %v: %s", d.Id(), parentId, err)
399399
}
400400

401401
return nil

0 commit comments

Comments
 (0)