Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Avoid sending empty update request
Browse files Browse the repository at this point in the history
  • Loading branch information
TaihengJin committed Oct 15, 2021
1 parent d8f99ff commit 08171c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/provider/resource_service_account.go
Expand Up @@ -55,16 +55,15 @@ func serviceAccountUpdate(ctx context.Context, d *schema.ResourceData, meta inte
return diag.FromErr(fmt.Errorf("display_name field cannot be updated for a service account"))
}

c := meta.(*Client)

description := extractDescription(d)

updateReq := iam.NewV2ServiceAccountUpdate()

if d.HasChange(paramDescription) {
description := extractDescription(d)
updateReq.SetDescription(description)
} else {
return nil
}

c := meta.(*Client)
req := c.iamClient.ServiceAccountsV2Api.UpdateV2ServiceAccount(c.iamApiContext(ctx), d.Id()).V2ServiceAccountUpdate(*updateReq)

_, _, err := req.Execute()
Expand Down

0 comments on commit 08171c5

Please sign in to comment.