-
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
Granting a database role to a share fails with "Root object was present, but now absent." #2410
Comments
Hey @kingalban . Thanks for reporting the issue. As this is a new resource we will analyze it shortly. |
Hey @kingalban, resource "snowflake_database" "test" {
name = var.database
}
resource "snowflake_database_role" "test" {
database = snowflake_database.test.name
name = var.database_role_name
}
resource "snowflake_share" "test" {
name = var.share_name
}
resource "snowflake_grant_privileges_to_share" "test" {
privileges = ["USAGE"]
on_database = snowflake_database.test.name
to_share = snowflake_share.test.name
}
resource "snowflake_grant_database_role" "test" {
database_role_name = "\"${snowflake_database.test.name}\".\"${snowflake_database_role.test.name}\""
share_name = snowflake_share.test.name
} |
Fixes: #2410 The root cause of the issue was that in SHOW GRANTS conversion from row representation to SDK object representation, we had a special case for shares that would split it on dot. Share may have only one part and this change adds support for such a situation. Additionally, it was covered by an existing test that was commented out and was waiting for the `snowflake_grant_privileges_to_share` resource.
Hey @kingalban |
Yes, this resolved my issues! |
Terraform CLI and Provider Versions
Terraform v1.7.0
on linux_amd64
Terraform Configuration
Expected Behavior
The share
snowflake_share.example_share
should be granted the privilegeUSAGE
on the databasesnowflake_database.example_database
and database rolesnowflake_database_role.exampled_database_role
.Actual Behavior
terraform apply
produces a reasonable plan, but when it goes to apply it gives this error:Checking Snowflake, the share wasn't granted any privileges on the database role.
Repeating
terraform apply
, it shows that thesnowflake_grant_database_role.share_use_database_role
needs to be created. Trying to do that gives the same error.Steps to Reproduce
terraform apply
How much impact is this issue causing?
High
Logs
No response
Additional Information
because of the depreciation of grants like
snowflake_database_grant
, and the fact thatsnowflake_grant_privileges_to_share
doesn't exist yet, I don't see how I can use the provider to manage shares.Specifically, I am already managing privileges on the database of interest using the
snowflake_grant_privileges_to_role
resource, and combining that resource withsnowflake_database_grant
results in nasty conflictsThe text was updated successfully, but these errors were encountered: