-
Notifications
You must be signed in to change notification settings - Fork 427
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]: Error occurred when transferring ownership back to the original role #3317
Comments
Hey @jonathanneo. Thanks for reaching out to us. We got back from the holiday break and we will verify the issue this week. |
Hey @jonathanneo. I am not an expert on RBAC in Snowflake but I have a few questions:
This is not aligned, at least from my understanding, with the docs for managed schemas:
As I understand it, these objects can still be owned by other roles (however, as you have shown, granting ownership to some role—in your case, ACCOUNTADMIN—fails with the referenced error).
We will consider it. I also see another option to detect what kind of schema we are dealing with and dynamically adjust the statement run on destroy. However, it poses some challenges/questions (e.g., will we always see the schema kind?). Nevertheless, I would like to wait for such an addition until the whole team is back from holidays and consult internally. Even if we don't decide to add it quickly, we will document this as a current limitation with potential workarounds. cc: @sfc-gh-jcieslak |
We will discuss it at the start of next week. |
Thanks for clarifying that in managed schemas, the schema owner manages all privilege grants, and object owners retain the OWNERSHIP privileges on the objects. I had misunderstood that point.
Yes, our RBAC model requires that we do so because we want to have a role scoped at the schema-level to own all objects underneath it e.g. tables and views. Below is how we apply RBAC at my company.
|
Terraform CLI Version
1.9.0
Terraform Provider Version
1.0.1
Company Name
No response
Terraform Configuration
Category
category:grants
Object type(s)
No response
Expected Behavior
I expect to perform
apply
and thendestroy
without any issues.Actual Behavior
The
apply
succeeds.However, the
destroy
fails with the following error:This is because the provider attempts to transfer ownership back to the deployment role (e.g.
ACCOUNTADMIN
) whilst the schema is still owned by theMY__OWNER
role:I understand that this provider behaviour is intended, as ownership was first transferred from
ACCOUNTADMIN
toMY__OWNER
role during theapply
, and thedestroy
is just doing the reverse.However, during a
destroy
, this provider behaviour of transferring ownership back toACCOUNTADMIN
conflicts with Snowflake's behaviour for managed access schemas. With managed access schemas, Snowflake requires that ownership of child objects of a schema (e.g. tables and views) must belong to the role that currently owns the schema (i.e.MY__OWNER
) or a child role under the role that owns the schema.As a workaround, I had to use a custom
snowflake_execute
resource to perform a simple grant and revoke ownership, instead of thesnowflake_grant_ownership
resource which attempts to transfer ownership during a destroy:Would it be possible to add a flag to the
snowflake_grant_ownership
resource for something liketransfer_ownership = false
so that instead of transferring ownership back to the deployment role (e.g.accountadmin
), it just does a simple revoke.Steps to Reproduce
How much impact is this issue causing?
Medium
Logs
No response
Additional Information
No response
Would you like to implement a fix?
The text was updated successfully, but these errors were encountered: