This pull request introduces a fix for an issue #173, when a deleted user attributes were not cleaned from the GSuite.
The fix is basically a change of a UsersService.Patch method to UsersService.Update.
SDK documentation for Patch describes the following:
Patch: Updates a user using patch semantics. The update method should be used instead, since it also supports patch semantics and has better performance. This method is unable to clear fields that contain repeated objects (addresses, phones, etc). Use the update method instead.
SDK documentation for Update describes the following:
Update: Updates a user. This method supports patch semantics, meaning you only need to include the fields you wish to update. Fields that are not present in the request will be preserved, and fields set to null will be cleared.
Hey,
This pull request introduces a fix for an issue #173, when a deleted user attributes were not cleaned from the GSuite.
The fix is basically a change of a
UsersService.Patch
method toUsersService.Update
.SDK documentation for
Patch
describes the following:SDK documentation for
Update
describes the following:Request
``` 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: ---[ REQUEST ]--------------------------------------- 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: PUT /admin/directory/v1/users/111111111111111111111?alt=json&prettyPrint=false HTTP/1.1 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: Host: www.googleapis.com 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: User-Agent: google-api-go-client/0.5 (darwin amd64) Terraform/0.13.3 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: Content-Length: 68 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: Content-Type: application/json 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: X-Goog-Api-Client: gl-go/1.15.2 gdcl/20200514 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: Accept-Encoding: gzip 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: { 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: "customSchemas": { 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: "MYSCHEMA": { 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: "Role": null, 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: "SessionDuration": null 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: } 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: } 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: } 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: 2021-04-19T09:26:28.490+0300 [DEBUG] plugin.terraform-provider-gsuite: ----------------------------------------------------- ```Response
``` 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: ---[ RESPONSE ]-------------------------------------- 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: HTTP/2.0 200 OK 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Cache-Control: private 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Content-Type: application/json; charset=UTF-8 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Date: Mon, 19 Apr 2021 06:26:30 GMT 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Etag: "FucLvn8vxpes0ORl150wm2v8Iou3obCSH1t_mF1KVCg/cRGj8OOSQSPtWf_t3zn3WOL3lC4" 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Server: ESF 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Vary: Origin 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Vary: X-Origin 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: Vary: Referer 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: X-Content-Type-Options: nosniff 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: X-Frame-Options: SAMEORIGIN 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: X-Xss-Protection: 0 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: { 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "kind": "admin#directory#user", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "id": "111111111111111111111", gsuite_user_attributes.test: Destruction complete after 2s 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "etag": "\"FucLvn8vxpes0ORl150wm2v8Iou3obCSH1t_mF1KVCg/cRGj8OOSQSPtWf_t3zn3WOL3lC4\"", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "primaryEmail": "luke.skywalker@starwars.com", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "name": { 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "givenName": "Luke", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "familyName": "Skywalker", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "fullName": "Luke Skywalker" 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: }, 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "isAdmin": false, 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "isDelegatedAdmin": false, 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "lastLoginTime": "2021-04-13T11:56:26.000Z", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "creationTime": "2021-04-13T09:57:30.000Z", 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "agreedToTerms": true, 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "suspended": false, 2021-04-19T09:26:29.845+0300 [DEBUG] plugin.terraform-provider-gsuite: "archived": false, 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "changePasswordAtNextLogin": false, 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "ipWhitelisted": false, 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "emails": [ 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: { 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "address": "luke.skywalker@starwars.com", 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "primary": true 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: }, 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: { 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "address": "the-jedi@starwars.com" 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: } 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: ], 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "aliases": [ 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "the-jedi@starwars.com" 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: ], 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "customerId": "XXX", 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "orgUnitPath": "/starwars.com", 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "isMailboxSetup": true, 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "includeInGlobalAddressList": true, 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: "recoveryEmail": "" 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: } 2021-04-19T09:26:29.846+0300 [DEBUG] plugin.terraform-provider-gsuite: ----------------------------------------------------- ```