-
Notifications
You must be signed in to change notification settings - Fork 420
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
[Bug]: Failed to revoke privileges to add for IMPORTED PRIVILEGES on SNOWFLAKE database #2803
Comments
I'm wondering whether you can give grant_options for IMPORTED PRIVILEGES? |
It seems like the concept of grant options is not relevant for While On another (non-shared) database, that syntax does actually work and sets the |
Hey @RobbertDM 👋 |
Thanks for the quick answer @sfc-gh-jcieslak However, then it gives me
I am on Snowflake terraform provider 0.89, is this introduced later? Also, we might want to update the main docs then, they mention |
Possibly relevant comment in the code:
|
Ah, I think I found the one causing trouble: terraform-provider-snowflake/pkg/resources/grant_privileges_to_account_role.go Lines 529 to 532 in 319ddc3
and specifically, line 531 sets As you mentioned before, So I think updates will always fail. |
Yeah, so my bad. The resource should be working with resource "snowflake_grant_privileges_to_account_role" "test" {
account_role_name = "TEST_ROLE"
privileges = [ "IMPORTED PRIVILEGES" ]
on_account_object {
object_type = "DATABASE"
object_name = "SNOWFLAKE"
}
with_grant_option = false
} It ran |
Hey @RobbertDM 👋 |
Actually this is not yet solved.
This is our code definition: resource "snowflake_grant_privileges_to_account_role" "grant_on_snowflake_database_to_datadog" {
account_role_name = snowflake_role.datadog.name
privileges = ["IMPORTED PRIVILEGES"]
on_account_object {
object_type = "DATABASE"
object_name = "SNOWFLAKE"
}
with_grant_option = false
} The code is applied successfully the first time, but then every time terraform runs again, the issue presents. |
Interesting, I'll reproduce the issue and get back to you. |
I started seeing this issue in 0.92.0 as well, then upgraded to 0.95.0, where it was still happening. I ended up manually running the revoke/grant statements for imported privileges which seems to have resolved it. |
Hey 👋 resource "snowflake_grant_privileges_to_account_role" "test" {
account_role_name = "TEST_ROLE"
privileges = ["IMPORTED PRIVILEGES"]
on_account_object {
object_type = "DATABASE"
object_name = "SNOWFLAKE"
}
} Maybe that's more connected to Snowflake than the provider itself. Please run the |
Here is the query being run that fails. My terraform is identical to the above.
|
what statements worked? |
Hi @martingehrke 👋 |
Terraform CLI Version
1.3.8
Terraform Provider Version
0.89
Terraform Configuration
Category
category:resource
Object type(s)
No response
Expected Behavior
Use
snowflake_grant_privileges_to_account_role
to grantIMPORTED PRIVILEGES
on theSNOWFLAKE
database to some roles withwith_grant_option = false
.Actual Behavior
It gives an error when revoking the privilege.
The SQL produced indeed is not valid, it produces:
REVOKE GRANT OPTION FOR IMPORTED PRIVILEGES ON DATABASE "SNOWFLAKE" FROM ROLE "SNOWFLAKE_INSPECTION"
instead what is correct is
REVOKE IMPORTED PRIVILEGES ON DATABASE "SNOWFLAKE" FROM ROLE "SNOWFLAKE_INSPECTION"
Steps to Reproduce
run terraform apply on this, replacing the "SNOWFLAKE_INSPECTION" role with one that you have on your Snowflake account:
How much impact is this issue causing?
Low
Logs
No response
Additional Information
No response
Would you like to implement a fix?
The text was updated successfully, but these errors were encountered: