dbt-labs / terraform-provider-dbtcloud

dbt Cloud Terraform Provider
https://registry.terraform.io/providers/dbt-labs/dbtcloud
MIT License
80 stars 18 forks source link

Cannot Find User with Capital Letters in Email #199

Closed anaghshineh closed 9 months ago

anaghshineh commented 9 months ago

Hey, @b-per! Been testing out all the great work you've done recently around users + user groups.

Everything is working super well, but I hit a small, annoying snag. I've been able to retrieve user data for various emails of existing dbt Cloud users - all of their emails only have lowercase letters (e.g., firstname.lastname@org.com). However, I keep hitting the following error when trying to retrieve a user with capital letters in their email:

Error: Did not find user with email Firstname.Lastname@org.com

I looked at the code and didn't see anything obvious that could be causing this. I did confirm that I could find this user's email in the results returned by hitting https://cloud.getdbt.com/api/v2/accounts/<account-number>/users/?limit=1000.

Any idea what might be going on? Thanks!

b-per commented 9 months ago

Thanks for raising this. The provider is currently comparing the inputs and the results from the API with the == check. It makes sense to compare those strings without taking in account upper and lowercase so I will do this change and release a new version of the provider today or tomorrow. Let's then see if it fixes this use case.

b-per commented 9 months ago

Actually, to double check something. Does the user appear if you call the URL without limit=1000?

https://cloud.getdbt.com/api/v2/accounts/<account-number>/users/

The issue might not be about upper and lowercase but about your account having more than 100 users

b-per commented 9 months ago

I updated the logic in 0.2.10, feel free to comment and I can reopen if this is not fixed

anaghshineh commented 9 months ago

Thank you - as usual - for the speedy reply! You're right that this user falls over the 100-user mark (we have about ~105!). I'll give 0.2.10 a whirl ❤️

b-per commented 9 months ago

Thanks for the update! Yes, the 100 limit should be fixed as well. And now you could also find users by their emails without worrying about upper/lower case as well.

anaghshineh commented 9 months ago

Amazing! Confirming that it works now.