terraform-provider-googleworkspace icon indicating copy to clipboard operation
terraform-provider-googleworkspace copied to clipboard

Ability to transfer user data before deletion

Open tammersaleh opened this issue 3 years ago • 4 comments

Affected Resource(s)

  • google_workspace_user

Feature Request

When I delete a google workspace user from the admin interface, I'm allowed to transfer their data as part of the process. (see this doc)

We're transitioning to managing all google users through this provider and would like to retain this functionality. I imagine a new block could be added to the resource like such:

resource "googleworkspace_user" "dwight" {
  primary_email = "[email protected]"
  ...

  transfer_data_upon_deletion {
    target_user_email = "[email protected]"
    transfer_email = true
    transfer_drive_files = true
    transfer_...
  }

Potential Issues

I'm unsure how the admin console juggles data transfer before user deletion. If Terraform initiates the data transfer and then deletes the user, will Google know to queue the deletion to happen after the transfer finishes, or will the deletion call fail? (or worse: will the transfer be aborted?)

References

A quick search makes me think this is the data transfer API used by the admin console.

tammersaleh avatar Jan 09 '23 16:01 tammersaleh

+1

enchorb avatar Jan 27 '23 13:01 enchorb

I finally had time to implement this for my fork 😅

https://registry.terraform.io/providers/SamuZad/googleworkspace/latest/docs/resources/user#nestedblock--on_delete_data_transfer

https://github.com/SamuZad/terraform-provider-googleworkspace/commit/834b20a9187ca8f4f1721c79c39cdf5f201f9361

SamuZad avatar May 11 '24 15:05 SamuZad