Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform import googleworkspace_user needs clarification #266

Closed
pat-s opened this issue Feb 26, 2022 · 3 comments · Fixed by #278
Closed

terraform import googleworkspace_user needs clarification #266

pat-s opened this issue Feb 26, 2022 · 3 comments · Fixed by #278
Assignees

Comments

@pat-s
Copy link

pat-s commented Feb 26, 2022

Reading the documentation of v0.6.0, I assumed I need to pass the "ID" shown in the URL when visiting a user profile.
However, this value is not accepted.
Using the primary email of a user succeeds but does not update the actual terraform block.
Anyhow, I think the example in https://registry.terraform.io/providers/hashicorp/googleworkspace/latest/docs/resources/user#import should note that the primary email should be used.

Is the empty import a bug of the googleworkspace_user resource or am I doing something wrong?

Edit: the import issue also applies to googleworkspace_group whereas here the actual "ID" found in the URL can be used

@enchorb
Copy link

enchorb commented May 21, 2022

+1, was stuck figuring this out for a bit

@SarahFrench
Copy link
Member

Thanks for posting your issue and solution here @pat-s - I've investigated this and it's definitely interesting how user and group behave differently.

For users I found out that the numerical ID shown in the current example in the docs, ie. :

terraform import googleworkspace_user.dwight 123456789012345678901

is a unique ID that all Google accounts are assigned. They're not the same as the alphanumerical identifier shown in the URL of a user in Google Workspace and I don't think they're viewable in the Google Workspace UI anywhere. I think the only ways to view them are in API responses and, weirdly, via the approach in this gist: https://gist.github.com/msafi/b1cb05bfab5b897c57e6

I also checked the import for groups and saw how the alphanumerical identifier in Google Workspace URLs can be used for import in that case.

This is definitely confusing, so I'll update the docs for both resources to recommend using emails when importing to state. Thanks again for flagging it 😁

@derek-burdick
Copy link

I just verified that running IMPORT using the primary_email works just fine. I would recommend the example show import using a username. If there are edge cases that require the numeric ID, then that could be added to the docs as a note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants