Skip to content
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

Conditional Masking Policy #1656

Open
amit0904 opened this issue Mar 27, 2023 · 2 comments
Open

Conditional Masking Policy #1656

amit0904 opened this issue Mar 27, 2023 · 2 comments
Labels
category:resource feature-request Used to mark issues with provider's missing functionalities resource:masking_policy Issue connected to the snowflake_masking_policy resource

Comments

@amit0904
Copy link

amit0904 commented Mar 27, 2023

Snowflake allows to create conditional masking policy

https://docs.snowflake.com/en/sql-reference/sql/create-masking-policy#example-conditional-masking-policy

-- Conditional Masking

create masking policy email_visibility as
(email varchar, visibility string) returns varchar ->
  case
    when current_role() = 'ADMIN' then email
    when visibility = 'Public' then email
    else '***MASKED***'
  end;

Support for multiple value_data_type

resource "snowflake_masking_policy" "example_masking_policy" {
  name               = "EXAMPLE_MASKING_POLICY"
  database           = "EXAMPLE_DB"
  schema             = "EXAMPLE_SCHEMA"
  value_data_type    = "email varchar, visibility string"
  masking_expression = "case when current_role() in ('ANALYST') then val else sha2(val, 512) end"
  return_data_type   = "string"
}
@amit0904 amit0904 added the feature-request Used to mark issues with provider's missing functionalities label Mar 27, 2023
@dlouseiro
Copy link

We're also in need of this feature!

@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:masking_policy Issue connected to the snowflake_masking_policy resource labels May 20, 2024
@sfc-gh-jmichalak
Copy link
Collaborator

Hi, sorry for the late response. We've released v0.96.0, which includes adjusting and fixing masking policies. Please upgrade with the migration guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:resource feature-request Used to mark issues with provider's missing functionalities resource:masking_policy Issue connected to the snowflake_masking_policy resource
Projects
None yet
Development

No branches or pull requests

4 participants