-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle IMPORTED PRIVILEGES privileges in privilege-to-role gran…
…ting resources (#2471) IMPORTED PRIVILEGES privilege is a special case where returned (IMPORTED PRIVILEGES) privilege from SHOW GRANTS shows up as a USAGE privilege. Thus, I had to create a logic that would swap those two in the Read operation. As IMPORTED PRIVILEGES is a privilege that can only be applied to the database created from share, I had to create a test with share and the database created on the second account. References - #1890 (comment) - #1998
- Loading branch information
1 parent
93af462
commit eb20051
Showing
8 changed files
with
318 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
pkg/resources/testdata/TestAcc_GrantPrivilegesToAccountRole/ImportedPrivileges/test.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
resource "snowflake_database" "test" { | ||
name = var.shared_database_name | ||
data_retention_time_in_days = 0 | ||
from_share = { | ||
provider = var.account_name | ||
share = var.share_name | ||
} | ||
} | ||
|
||
resource "snowflake_role" "test" { | ||
name = var.role_name | ||
} | ||
|
||
resource "snowflake_grant_privileges_to_account_role" "test" { | ||
depends_on = [snowflake_database.test, snowflake_role.test] | ||
account_role_name = "\"${var.role_name}\"" | ||
privileges = var.privileges | ||
on_account_object { | ||
object_type = "DATABASE" | ||
object_name = "\"${var.shared_database_name}\"" | ||
} | ||
} |
Oops, something went wrong.