terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
[Bug]: Error when using data source snowflake_users
Terraform CLI Version
1.6.6
Terraform Provider Version
0.92.0
Terraform Configuration
data "snowflake_users" "all_users" {
pattern = "%MATSMART%"
}
Category
category:data_source
Object type(s)
data_source:users
Expected Behavior
I expect the data source to return a list of users, since the there are users matching the pattern.
Actual Behavior
null is returned.
Steps to Reproduce
Snowflake version: 8.23.5
- Create a user with the name "[email protected]"
- Use the resource as specified above, it should return the user you just created
How much impact is this issue causing?
Medium
Logs
https://gist.github.com/calleo/9b37c61b37eb138c16518bbc19c50d86
Additional Information
Looks like a problem with parsing the output of SHOW USERS. I have tried executing the exact same SQL statement, with the same user and role, and can see that it actually returns users.
My initial thought was that the disabled column contained null values, but I can also see true/false.
Would you like to implement a fix?
- [ ] Yeah, I'll take it 😎
Hey @calleo . Thanks for reaching out to us.
The user datasource will be redesigned as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#preparing-essential-ga-objects-for-the-provider-v1. I will link this issue to https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/ESSENTIAL_GA_OBJECTS.MD. As a workaround, you can use unsafe_execute with query parameter.
I am having the same issue at the moment, this used to work up to one month ago from the date, I guess there were some changes on the API in Snowflake side.
In our case we are using the TF provider 0.89.0
Also seems like the reply from the api gives some fields as null while running SHOW USERS LIKE 'MY_USER' from the UI actually returns those fields as true/false
Hey @calleo.
We have just released v0.95.0 of the provider. It contains a reworked snowflake_users data source. Please consult the migration guide.
Closing the issue due to inactivity. Please create a new one if the issue persists in the newest version of the provider.