-
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
feat: Masking policy resource v1 #3078
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
81346b6
Init
sfc-gh-jmichalak 19ddfb7
Cleanup
sfc-gh-jmichalak b387a1f
Cleanup
sfc-gh-jmichalak 97e5305
Merge remote-tracking branch 'origin/main' into masking-policy-v1
sfc-gh-jmichalak c3fed83
Cleanup
sfc-gh-jmichalak ed7a13f
Fix tests
sfc-gh-jmichalak 8573b9d
Review suggestions
sfc-gh-jmichalak bd36e59
pre push
sfc-gh-jmichalak 3510612
Adjust migration guide
sfc-gh-jmichalak ca5af18
Merge remote-tracking branch 'origin/main' into masking-policy-v1
sfc-gh-jmichalak badb691
Merge remote-tracking branch 'origin/main' into masking-policy-v1
sfc-gh-jmichalak 09b6009
Resolve signature parsers
sfc-gh-jmichalak 03612ef
Fix tests
sfc-gh-jmichalak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# format is database name | schema name | policy name | ||
terraform import snowflake_masking_policy.example 'dbName|schemaName|policyName' | ||
terraform import snowflake_row_access_policy.example '"<database_name>"."<schema_name>"."<masking_policy_name>"' |
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 |
---|---|---|
@@ -1,23 +1,61 @@ | ||
# basic resource | ||
resource "snowflake_masking_policy" "test" { | ||
name = "EXAMPLE_MASKING_POLICY" | ||
database = "EXAMPLE_DB" | ||
schema = "EXAMPLE_SCHEMA" | ||
signature { | ||
column { | ||
name = "val" | ||
type = "VARCHAR" | ||
} | ||
argument { | ||
name = "ARG1" | ||
type = "VARCHAR" | ||
} | ||
masking_expression = <<-EOF | ||
case | ||
when current_role() in ('ROLE_A') then | ||
val | ||
when is_role_in_session( 'ROLE_B' ) then | ||
'ABC123' | ||
else | ||
'******' | ||
end | ||
EOF | ||
|
||
argument { | ||
name = "ARG2" | ||
type = "NUMBER" | ||
} | ||
argument { | ||
name = "ARG3" | ||
type = "TIMESTAMP_NTZ" | ||
} | ||
body = <<-EOF | ||
case | ||
when current_role() in ('ROLE_A') then | ||
ARG1 | ||
when is_role_in_session( 'ROLE_B' ) then | ||
'ABC123' | ||
else | ||
'******' | ||
end | ||
EOF | ||
return_data_type = "VARCHAR" | ||
} | ||
|
||
# resource with all fields set | ||
resource "snowflake_masking_policy" "test" { | ||
name = "EXAMPLE_MASKING_POLICY" | ||
database = "EXAMPLE_DB" | ||
schema = "EXAMPLE_SCHEMA" | ||
argument { | ||
name = "ARG1" | ||
type = "VARCHAR" | ||
} | ||
argument { | ||
name = "ARG2" | ||
type = "NUMBER" | ||
} | ||
argument { | ||
name = "ARG3" | ||
type = "TIMESTAMP_NTZ" | ||
} | ||
body = <<-EOF | ||
case | ||
when current_role() in ('ROLE_A') then | ||
ARG1 | ||
when is_role_in_session( 'ROLE_B' ) then | ||
'ABC123' | ||
else | ||
'******' | ||
end | ||
EOF | ||
return_data_type = "VARCHAR" | ||
exempt_other_policies = "true" | ||
comment = "example masking policy" | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chenged -> changed