-
Notifications
You must be signed in to change notification settings - Fork 426
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]: Provider produced inconsistent result after apply (snowflake_grant_ownership) #3253
Comments
If I change Code: resource "snowflake_grant_ownership" "change_schema_ownership" {
database_role_name = snowflake_database_role.my_schema_reader.fully_qualified_name
on {
object_type = "SCHEMA"
object_name = snowflake_schema.my_schema.fully_qualified_name
}
outbound_privileges = "COPY"
} Error:
I am getting the same error even if I execute the SQL code directly: GRANT OWNERSHIP ON SCHEMA "MY_PROJECT_DB"."MY_SCHEMA" TO DATABASE ROLE "MY_PROJECT_DB"."MY_SCHEMA_READER" COPY CURRENT GRANTS This appears to be because the deployment role needs to have the |
Hey @jonathanneo |
Ah yes, of course! Why didn't I think of that 😓 I've swapped the code to below, and it works 👏 # Grant usage first!
resource "snowflake_grant_database_role" "grant_usage_on_database_role" {
database_role_name = snowflake_database_role.my_schema_reader.fully_qualified_name
parent_role_name = "MY_DEPLOYMENT_ROLE"
}
# Then change ownership
resource "snowflake_grant_ownership" "change_schema_ownership" {
database_role_name = snowflake_database_role.my_schema_reader.fully_qualified_name
on {
object_type = "SCHEMA"
object_name = snowflake_schema.my_schema.fully_qualified_name
}
outbound_privileges = "REVOKE"
} |
Great to hear :) |
Terraform CLI Version
1.9.0
Terraform Provider Version
0.99.0
Company Name
No response
Terraform Configuration
Category
category:grants
Object type(s)
No response
Expected Behavior
I expect the role ownership transfer to execute successfully to transfer ownership from the deployment role to the database role (
MY_DATABASE.MY_SCHEMA_READER
).I have tested this in SQL, and it works:
Actual Behavior
In Snowflake Query History, the failure is caused by this query:
Since I have just changed the ownership of the schema to a different role, the deployment role doesn't have permissions to execute
SHOW GRANTS
on the schema.I plan to do
GRANT DATABASE ROLE
to the deployment role later on, so that the deployment role canUSE
the database role. But theSHOW GRANTS
fromresource "snowflake_grant_ownership"
is causing the error and preventing me from doing so.Steps to Reproduce
Use the terraform code provided above.
Run terraform apply, and the bug will reproduced.
How much impact is this issue causing?
High
Logs
No response
Additional Information
No response
Would you like to implement a fix?
The text was updated successfully, but these errors were encountered: