DeviaVir / terraform-provider-gsuite

A @HashiCorp Terraform provider for managing G Suite resources.
MIT License
271 stars 77 forks source link

Remove a block which failed with the wrong error #164

Closed psalaberria002 closed 3 years ago

psalaberria002 commented 3 years ago

We had a case where the API had some users with the MEMBER role, but the Terraform config was trying to set the OWNER role to them.

We got Error: [ERROR] Error updating memberships: [ERROR] Error updating groupMember (x@x.com): nested groups should be role MEMBER which made no sense.

Is there any reason for that condition to be in the reconcile function?

DeviaVir commented 3 years ago

Yes, this condition prevents users trying to add nested groups as role OWNER (which is not allowed by the admin API)

psalaberria002 commented 3 years ago

That happens in a different block in the same file. This block is hit even when the member is not a group. I suspect is coming from an old copy paste.

psalaberria002 commented 3 years ago

@DeviaVir can you have another look?

DeviaVir commented 3 years ago

I see: https://github.com/DeviaVir/terraform-provider-gsuite/blob/dc6b8e9c7db9f9b93f38571ade954468dc3f2322/gsuite/resource_group_members.go#L279-L282

Ack.