Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Snowflake

v0.2.1 published on Monday, Sep 27, 2021 by Pulumi

MaskingPolicy

Import

format is database name | schema name | policy name

 $ pulumi import snowflake:index/maskingPolicy:MaskingPolicy example 'dbName|schemaName|policyName'

Example Usage

using Pulumi;
using Snowflake = Pulumi.Snowflake;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleMaskingPolicy = new Snowflake.MaskingPolicy("exampleMaskingPolicy", new Snowflake.MaskingPolicyArgs
        {
            Database = "EXAMPLE_DB",
            MaskingExpression = "case when current_role() in ('ANALYST') then val else sha2(val, 512) end",
            ReturnDataType = "string",
            Schema = "EXAMPLE_SCHEMA",
            ValueDataType = "string",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := snowflake.NewMaskingPolicy(ctx, "exampleMaskingPolicy", &snowflake.MaskingPolicyArgs{
			Database:          pulumi.String("EXAMPLE_DB"),
			MaskingExpression: pulumi.String("case when current_role() in ('ANALYST') then val else sha2(val, 512) end"),
			ReturnDataType:    pulumi.String("string"),
			Schema:            pulumi.String("EXAMPLE_SCHEMA"),
			ValueDataType:     pulumi.String("string"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_snowflake as snowflake

example_masking_policy = snowflake.MaskingPolicy("exampleMaskingPolicy",
    database="EXAMPLE_DB",
    masking_expression="case when current_role() in ('ANALYST') then val else sha2(val, 512) end",
    return_data_type="string",
    schema="EXAMPLE_SCHEMA",
    value_data_type="string")
import * as pulumi from "@pulumi/pulumi";
import * as snowflake from "@pulumi/snowflake";

const exampleMaskingPolicy = new snowflake.MaskingPolicy("example_masking_policy", {
    database: "EXAMPLE_DB",
    maskingExpression: "case when current_role() in ('ANALYST') then val else sha2(val, 512) end",
    returnDataType: "string",
    schema: "EXAMPLE_SCHEMA",
    valueDataType: "string",
});

Create a MaskingPolicy Resource

new MaskingPolicy(name: string, args: MaskingPolicyArgs, opts?: CustomResourceOptions);
@overload
def MaskingPolicy(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  comment: Optional[str] = None,
                  database: Optional[str] = None,
                  masking_expression: Optional[str] = None,
                  name: Optional[str] = None,
                  return_data_type: Optional[str] = None,
                  schema: Optional[str] = None,
                  value_data_type: Optional[str] = None)
@overload
def MaskingPolicy(resource_name: str,
                  args: MaskingPolicyArgs,
                  opts: Optional[ResourceOptions] = None)
func NewMaskingPolicy(ctx *Context, name string, args MaskingPolicyArgs, opts ...ResourceOption) (*MaskingPolicy, error)
public MaskingPolicy(string name, MaskingPolicyArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args MaskingPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args MaskingPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MaskingPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MaskingPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

MaskingPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The MaskingPolicy resource accepts the following input properties:

Database string
The database in which to create the masking policy.
MaskingExpression string
Specifies the SQL expression that transforms the data.
ReturnDataType string
Specifies the data type to return.
Schema string
The schema in which to create the masking policy.
ValueDataType string
Specifies the data type to mask.
Comment string
Specifies a comment for the masking policy.
Name string
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
Database string
The database in which to create the masking policy.
MaskingExpression string
Specifies the SQL expression that transforms the data.
ReturnDataType string
Specifies the data type to return.
Schema string
The schema in which to create the masking policy.
ValueDataType string
Specifies the data type to mask.
Comment string
Specifies a comment for the masking policy.
Name string
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
database string
The database in which to create the masking policy.
maskingExpression string
Specifies the SQL expression that transforms the data.
returnDataType string
Specifies the data type to return.
schema string
The schema in which to create the masking policy.
valueDataType string
Specifies the data type to mask.
comment string
Specifies a comment for the masking policy.
name string
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
database str
The database in which to create the masking policy.
masking_expression str
Specifies the SQL expression that transforms the data.
return_data_type str
Specifies the data type to return.
schema str
The schema in which to create the masking policy.
value_data_type str
Specifies the data type to mask.
comment str
Specifies a comment for the masking policy.
name str
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.

Outputs

All input properties are implicitly available as output properties. Additionally, the MaskingPolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing MaskingPolicy Resource

Get an existing MaskingPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MaskingPolicyState, opts?: CustomResourceOptions): MaskingPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        comment: Optional[str] = None,
        database: Optional[str] = None,
        masking_expression: Optional[str] = None,
        name: Optional[str] = None,
        return_data_type: Optional[str] = None,
        schema: Optional[str] = None,
        value_data_type: Optional[str] = None) -> MaskingPolicy
func GetMaskingPolicy(ctx *Context, name string, id IDInput, state *MaskingPolicyState, opts ...ResourceOption) (*MaskingPolicy, error)
public static MaskingPolicy Get(string name, Input<string> id, MaskingPolicyState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Comment string
Specifies a comment for the masking policy.
Database string
The database in which to create the masking policy.
MaskingExpression string
Specifies the SQL expression that transforms the data.
Name string
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
ReturnDataType string
Specifies the data type to return.
Schema string
The schema in which to create the masking policy.
ValueDataType string
Specifies the data type to mask.
Comment string
Specifies a comment for the masking policy.
Database string
The database in which to create the masking policy.
MaskingExpression string
Specifies the SQL expression that transforms the data.
Name string
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
ReturnDataType string
Specifies the data type to return.
Schema string
The schema in which to create the masking policy.
ValueDataType string
Specifies the data type to mask.
comment string
Specifies a comment for the masking policy.
database string
The database in which to create the masking policy.
maskingExpression string
Specifies the SQL expression that transforms the data.
name string
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
returnDataType string
Specifies the data type to return.
schema string
The schema in which to create the masking policy.
valueDataType string
Specifies the data type to mask.
comment str
Specifies a comment for the masking policy.
database str
The database in which to create the masking policy.
masking_expression str
Specifies the SQL expression that transforms the data.
name str
Specifies the identifier for the masking policy; must be unique for the database and schema in which the masking policy is created.
return_data_type str
Specifies the data type to return.
schema str
The schema in which to create the masking policy.
value_data_type str
Specifies the data type to mask.

Package Details

Repository
https://github.com/pulumi/pulumi-snowflake
License
Apache-2.0
Notes
This Pulumi package is based on the snowflake Terraform Provider.