1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. bigquerydatapolicy
  5. DataPolicy
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.bigquerydatapolicy.DataPolicy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    A BigQuery Data Policy

    To get more information about DataPolicy, see:

    Example Usage

    Bigquery Datapolicy Data Policy Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const taxonomy = new gcp.datacatalog.Taxonomy("taxonomy", {
        region: "us-central1",
        displayName: "taxonomy",
        description: "A collection of policy tags",
        activatedPolicyTypes: ["FINE_GRAINED_ACCESS_CONTROL"],
    });
    const policyTag = new gcp.datacatalog.PolicyTag("policy_tag", {
        taxonomy: taxonomy.id,
        displayName: "Low security",
        description: "A policy tag normally associated with low security items",
    });
    const dataPolicy = new gcp.bigquerydatapolicy.DataPolicy("data_policy", {
        location: "us-central1",
        dataPolicyId: "data_policy",
        policyTag: policyTag.name,
        dataPolicyType: "COLUMN_LEVEL_SECURITY_POLICY",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    taxonomy = gcp.datacatalog.Taxonomy("taxonomy",
        region="us-central1",
        display_name="taxonomy",
        description="A collection of policy tags",
        activated_policy_types=["FINE_GRAINED_ACCESS_CONTROL"])
    policy_tag = gcp.datacatalog.PolicyTag("policy_tag",
        taxonomy=taxonomy.id,
        display_name="Low security",
        description="A policy tag normally associated with low security items")
    data_policy = gcp.bigquerydatapolicy.DataPolicy("data_policy",
        location="us-central1",
        data_policy_id="data_policy",
        policy_tag=policy_tag.name,
        data_policy_type="COLUMN_LEVEL_SECURITY_POLICY")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquerydatapolicy"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/datacatalog"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		taxonomy, err := datacatalog.NewTaxonomy(ctx, "taxonomy", &datacatalog.TaxonomyArgs{
    			Region:      pulumi.String("us-central1"),
    			DisplayName: pulumi.String("taxonomy"),
    			Description: pulumi.String("A collection of policy tags"),
    			ActivatedPolicyTypes: pulumi.StringArray{
    				pulumi.String("FINE_GRAINED_ACCESS_CONTROL"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		policyTag, err := datacatalog.NewPolicyTag(ctx, "policy_tag", &datacatalog.PolicyTagArgs{
    			Taxonomy:    taxonomy.ID(),
    			DisplayName: pulumi.String("Low security"),
    			Description: pulumi.String("A policy tag normally associated with low security items"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = bigquerydatapolicy.NewDataPolicy(ctx, "data_policy", &bigquerydatapolicy.DataPolicyArgs{
    			Location:       pulumi.String("us-central1"),
    			DataPolicyId:   pulumi.String("data_policy"),
    			PolicyTag:      policyTag.Name,
    			DataPolicyType: pulumi.String("COLUMN_LEVEL_SECURITY_POLICY"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var taxonomy = new Gcp.DataCatalog.Taxonomy("taxonomy", new()
        {
            Region = "us-central1",
            DisplayName = "taxonomy",
            Description = "A collection of policy tags",
            ActivatedPolicyTypes = new[]
            {
                "FINE_GRAINED_ACCESS_CONTROL",
            },
        });
    
        var policyTag = new Gcp.DataCatalog.PolicyTag("policy_tag", new()
        {
            Taxonomy = taxonomy.Id,
            DisplayName = "Low security",
            Description = "A policy tag normally associated with low security items",
        });
    
        var dataPolicy = new Gcp.BigQueryDataPolicy.DataPolicy("data_policy", new()
        {
            Location = "us-central1",
            DataPolicyId = "data_policy",
            PolicyTag = policyTag.Name,
            DataPolicyType = "COLUMN_LEVEL_SECURITY_POLICY",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.datacatalog.Taxonomy;
    import com.pulumi.gcp.datacatalog.TaxonomyArgs;
    import com.pulumi.gcp.datacatalog.PolicyTag;
    import com.pulumi.gcp.datacatalog.PolicyTagArgs;
    import com.pulumi.gcp.bigquerydatapolicy.DataPolicy;
    import com.pulumi.gcp.bigquerydatapolicy.DataPolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var taxonomy = new Taxonomy("taxonomy", TaxonomyArgs.builder()
                .region("us-central1")
                .displayName("taxonomy")
                .description("A collection of policy tags")
                .activatedPolicyTypes("FINE_GRAINED_ACCESS_CONTROL")
                .build());
    
            var policyTag = new PolicyTag("policyTag", PolicyTagArgs.builder()
                .taxonomy(taxonomy.id())
                .displayName("Low security")
                .description("A policy tag normally associated with low security items")
                .build());
    
            var dataPolicy = new DataPolicy("dataPolicy", DataPolicyArgs.builder()
                .location("us-central1")
                .dataPolicyId("data_policy")
                .policyTag(policyTag.name())
                .dataPolicyType("COLUMN_LEVEL_SECURITY_POLICY")
                .build());
    
        }
    }
    
    resources:
      dataPolicy:
        type: gcp:bigquerydatapolicy:DataPolicy
        name: data_policy
        properties:
          location: us-central1
          dataPolicyId: data_policy
          policyTag: ${policyTag.name}
          dataPolicyType: COLUMN_LEVEL_SECURITY_POLICY
      policyTag:
        type: gcp:datacatalog:PolicyTag
        name: policy_tag
        properties:
          taxonomy: ${taxonomy.id}
          displayName: Low security
          description: A policy tag normally associated with low security items
      taxonomy:
        type: gcp:datacatalog:Taxonomy
        properties:
          region: us-central1
          displayName: taxonomy
          description: A collection of policy tags
          activatedPolicyTypes:
            - FINE_GRAINED_ACCESS_CONTROL
    

    Bigquery Datapolicy Data Policy Routine

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const taxonomy = new gcp.datacatalog.Taxonomy("taxonomy", {
        region: "us-central1",
        displayName: "taxonomy",
        description: "A collection of policy tags",
        activatedPolicyTypes: ["FINE_GRAINED_ACCESS_CONTROL"],
    });
    const policyTag = new gcp.datacatalog.PolicyTag("policy_tag", {
        taxonomy: taxonomy.id,
        displayName: "Low security",
        description: "A policy tag normally associated with low security items",
    });
    const test = new gcp.bigquery.Dataset("test", {
        datasetId: "dataset_id",
        location: "us-central1",
    });
    const customMaskingRoutine = new gcp.bigquery.Routine("custom_masking_routine", {
        datasetId: test.datasetId,
        routineId: "custom_masking_routine",
        routineType: "SCALAR_FUNCTION",
        language: "SQL",
        dataGovernanceType: "DATA_MASKING",
        definitionBody: "SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')",
        returnType: "{\"typeKind\" :  \"STRING\"}",
        arguments: [{
            name: "ssn",
            dataType: "{\"typeKind\" :  \"STRING\"}",
        }],
    });
    const dataPolicy = new gcp.bigquerydatapolicy.DataPolicy("data_policy", {
        location: "us-central1",
        dataPolicyId: "data_policy",
        policyTag: policyTag.name,
        dataPolicyType: "DATA_MASKING_POLICY",
        dataMaskingPolicy: {
            routine: customMaskingRoutine.id,
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    taxonomy = gcp.datacatalog.Taxonomy("taxonomy",
        region="us-central1",
        display_name="taxonomy",
        description="A collection of policy tags",
        activated_policy_types=["FINE_GRAINED_ACCESS_CONTROL"])
    policy_tag = gcp.datacatalog.PolicyTag("policy_tag",
        taxonomy=taxonomy.id,
        display_name="Low security",
        description="A policy tag normally associated with low security items")
    test = gcp.bigquery.Dataset("test",
        dataset_id="dataset_id",
        location="us-central1")
    custom_masking_routine = gcp.bigquery.Routine("custom_masking_routine",
        dataset_id=test.dataset_id,
        routine_id="custom_masking_routine",
        routine_type="SCALAR_FUNCTION",
        language="SQL",
        data_governance_type="DATA_MASKING",
        definition_body="SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')",
        return_type="{\"typeKind\" :  \"STRING\"}",
        arguments=[gcp.bigquery.RoutineArgumentArgs(
            name="ssn",
            data_type="{\"typeKind\" :  \"STRING\"}",
        )])
    data_policy = gcp.bigquerydatapolicy.DataPolicy("data_policy",
        location="us-central1",
        data_policy_id="data_policy",
        policy_tag=policy_tag.name,
        data_policy_type="DATA_MASKING_POLICY",
        data_masking_policy=gcp.bigquerydatapolicy.DataPolicyDataMaskingPolicyArgs(
            routine=custom_masking_routine.id,
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquerydatapolicy"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/datacatalog"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		taxonomy, err := datacatalog.NewTaxonomy(ctx, "taxonomy", &datacatalog.TaxonomyArgs{
    			Region:      pulumi.String("us-central1"),
    			DisplayName: pulumi.String("taxonomy"),
    			Description: pulumi.String("A collection of policy tags"),
    			ActivatedPolicyTypes: pulumi.StringArray{
    				pulumi.String("FINE_GRAINED_ACCESS_CONTROL"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		policyTag, err := datacatalog.NewPolicyTag(ctx, "policy_tag", &datacatalog.PolicyTagArgs{
    			Taxonomy:    taxonomy.ID(),
    			DisplayName: pulumi.String("Low security"),
    			Description: pulumi.String("A policy tag normally associated with low security items"),
    		})
    		if err != nil {
    			return err
    		}
    		test, err := bigquery.NewDataset(ctx, "test", &bigquery.DatasetArgs{
    			DatasetId: pulumi.String("dataset_id"),
    			Location:  pulumi.String("us-central1"),
    		})
    		if err != nil {
    			return err
    		}
    		customMaskingRoutine, err := bigquery.NewRoutine(ctx, "custom_masking_routine", &bigquery.RoutineArgs{
    			DatasetId:          test.DatasetId,
    			RoutineId:          pulumi.String("custom_masking_routine"),
    			RoutineType:        pulumi.String("SCALAR_FUNCTION"),
    			Language:           pulumi.String("SQL"),
    			DataGovernanceType: pulumi.String("DATA_MASKING"),
    			DefinitionBody:     pulumi.String("SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')"),
    			ReturnType:         pulumi.String("{\"typeKind\" :  \"STRING\"}"),
    			Arguments: bigquery.RoutineArgumentArray{
    				&bigquery.RoutineArgumentArgs{
    					Name:     pulumi.String("ssn"),
    					DataType: pulumi.String("{\"typeKind\" :  \"STRING\"}"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = bigquerydatapolicy.NewDataPolicy(ctx, "data_policy", &bigquerydatapolicy.DataPolicyArgs{
    			Location:       pulumi.String("us-central1"),
    			DataPolicyId:   pulumi.String("data_policy"),
    			PolicyTag:      policyTag.Name,
    			DataPolicyType: pulumi.String("DATA_MASKING_POLICY"),
    			DataMaskingPolicy: &bigquerydatapolicy.DataPolicyDataMaskingPolicyArgs{
    				Routine: customMaskingRoutine.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var taxonomy = new Gcp.DataCatalog.Taxonomy("taxonomy", new()
        {
            Region = "us-central1",
            DisplayName = "taxonomy",
            Description = "A collection of policy tags",
            ActivatedPolicyTypes = new[]
            {
                "FINE_GRAINED_ACCESS_CONTROL",
            },
        });
    
        var policyTag = new Gcp.DataCatalog.PolicyTag("policy_tag", new()
        {
            Taxonomy = taxonomy.Id,
            DisplayName = "Low security",
            Description = "A policy tag normally associated with low security items",
        });
    
        var test = new Gcp.BigQuery.Dataset("test", new()
        {
            DatasetId = "dataset_id",
            Location = "us-central1",
        });
    
        var customMaskingRoutine = new Gcp.BigQuery.Routine("custom_masking_routine", new()
        {
            DatasetId = test.DatasetId,
            RoutineId = "custom_masking_routine",
            RoutineType = "SCALAR_FUNCTION",
            Language = "SQL",
            DataGovernanceType = "DATA_MASKING",
            DefinitionBody = "SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')",
            ReturnType = "{\"typeKind\" :  \"STRING\"}",
            Arguments = new[]
            {
                new Gcp.BigQuery.Inputs.RoutineArgumentArgs
                {
                    Name = "ssn",
                    DataType = "{\"typeKind\" :  \"STRING\"}",
                },
            },
        });
    
        var dataPolicy = new Gcp.BigQueryDataPolicy.DataPolicy("data_policy", new()
        {
            Location = "us-central1",
            DataPolicyId = "data_policy",
            PolicyTag = policyTag.Name,
            DataPolicyType = "DATA_MASKING_POLICY",
            DataMaskingPolicy = new Gcp.BigQueryDataPolicy.Inputs.DataPolicyDataMaskingPolicyArgs
            {
                Routine = customMaskingRoutine.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.datacatalog.Taxonomy;
    import com.pulumi.gcp.datacatalog.TaxonomyArgs;
    import com.pulumi.gcp.datacatalog.PolicyTag;
    import com.pulumi.gcp.datacatalog.PolicyTagArgs;
    import com.pulumi.gcp.bigquery.Dataset;
    import com.pulumi.gcp.bigquery.DatasetArgs;
    import com.pulumi.gcp.bigquery.Routine;
    import com.pulumi.gcp.bigquery.RoutineArgs;
    import com.pulumi.gcp.bigquery.inputs.RoutineArgumentArgs;
    import com.pulumi.gcp.bigquerydatapolicy.DataPolicy;
    import com.pulumi.gcp.bigquerydatapolicy.DataPolicyArgs;
    import com.pulumi.gcp.bigquerydatapolicy.inputs.DataPolicyDataMaskingPolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var taxonomy = new Taxonomy("taxonomy", TaxonomyArgs.builder()
                .region("us-central1")
                .displayName("taxonomy")
                .description("A collection of policy tags")
                .activatedPolicyTypes("FINE_GRAINED_ACCESS_CONTROL")
                .build());
    
            var policyTag = new PolicyTag("policyTag", PolicyTagArgs.builder()
                .taxonomy(taxonomy.id())
                .displayName("Low security")
                .description("A policy tag normally associated with low security items")
                .build());
    
            var test = new Dataset("test", DatasetArgs.builder()
                .datasetId("dataset_id")
                .location("us-central1")
                .build());
    
            var customMaskingRoutine = new Routine("customMaskingRoutine", RoutineArgs.builder()
                .datasetId(test.datasetId())
                .routineId("custom_masking_routine")
                .routineType("SCALAR_FUNCTION")
                .language("SQL")
                .dataGovernanceType("DATA_MASKING")
                .definitionBody("SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')")
                .returnType("{\"typeKind\" :  \"STRING\"}")
                .arguments(RoutineArgumentArgs.builder()
                    .name("ssn")
                    .dataType("{\"typeKind\" :  \"STRING\"}")
                    .build())
                .build());
    
            var dataPolicy = new DataPolicy("dataPolicy", DataPolicyArgs.builder()
                .location("us-central1")
                .dataPolicyId("data_policy")
                .policyTag(policyTag.name())
                .dataPolicyType("DATA_MASKING_POLICY")
                .dataMaskingPolicy(DataPolicyDataMaskingPolicyArgs.builder()
                    .routine(customMaskingRoutine.id())
                    .build())
                .build());
    
        }
    }
    
    resources:
      dataPolicy:
        type: gcp:bigquerydatapolicy:DataPolicy
        name: data_policy
        properties:
          location: us-central1
          dataPolicyId: data_policy
          policyTag: ${policyTag.name}
          dataPolicyType: DATA_MASKING_POLICY
          dataMaskingPolicy:
            routine: ${customMaskingRoutine.id}
      policyTag:
        type: gcp:datacatalog:PolicyTag
        name: policy_tag
        properties:
          taxonomy: ${taxonomy.id}
          displayName: Low security
          description: A policy tag normally associated with low security items
      taxonomy:
        type: gcp:datacatalog:Taxonomy
        properties:
          region: us-central1
          displayName: taxonomy
          description: A collection of policy tags
          activatedPolicyTypes:
            - FINE_GRAINED_ACCESS_CONTROL
      test:
        type: gcp:bigquery:Dataset
        properties:
          datasetId: dataset_id
          location: us-central1
      customMaskingRoutine:
        type: gcp:bigquery:Routine
        name: custom_masking_routine
        properties:
          datasetId: ${test.datasetId}
          routineId: custom_masking_routine
          routineType: SCALAR_FUNCTION
          language: SQL
          dataGovernanceType: DATA_MASKING
          definitionBody: SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')
          returnType: '{"typeKind" :  "STRING"}'
          arguments:
            - name: ssn
              dataType: '{"typeKind" :  "STRING"}'
    

    Create DataPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DataPolicy(name: string, args: DataPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def DataPolicy(resource_name: str,
                   args: DataPolicyArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def DataPolicy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   data_policy_id: Optional[str] = None,
                   data_policy_type: Optional[str] = None,
                   location: Optional[str] = None,
                   policy_tag: Optional[str] = None,
                   data_masking_policy: Optional[DataPolicyDataMaskingPolicyArgs] = None,
                   project: Optional[str] = None)
    func NewDataPolicy(ctx *Context, name string, args DataPolicyArgs, opts ...ResourceOption) (*DataPolicy, error)
    public DataPolicy(string name, DataPolicyArgs args, CustomResourceOptions? opts = null)
    public DataPolicy(String name, DataPolicyArgs args)
    public DataPolicy(String name, DataPolicyArgs args, CustomResourceOptions options)
    
    type: gcp:bigquerydatapolicy:DataPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DataPolicyArgs
    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 DataPolicyArgs
    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 DataPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DataPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DataPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var dataPolicyResource = new Gcp.BigQueryDataPolicy.DataPolicy("dataPolicyResource", new()
    {
        DataPolicyId = "string",
        DataPolicyType = "string",
        Location = "string",
        PolicyTag = "string",
        DataMaskingPolicy = new Gcp.BigQueryDataPolicy.Inputs.DataPolicyDataMaskingPolicyArgs
        {
            PredefinedExpression = "string",
            Routine = "string",
        },
        Project = "string",
    });
    
    example, err := bigquerydatapolicy.NewDataPolicy(ctx, "dataPolicyResource", &bigquerydatapolicy.DataPolicyArgs{
    	DataPolicyId:   pulumi.String("string"),
    	DataPolicyType: pulumi.String("string"),
    	Location:       pulumi.String("string"),
    	PolicyTag:      pulumi.String("string"),
    	DataMaskingPolicy: &bigquerydatapolicy.DataPolicyDataMaskingPolicyArgs{
    		PredefinedExpression: pulumi.String("string"),
    		Routine:              pulumi.String("string"),
    	},
    	Project: pulumi.String("string"),
    })
    
    var dataPolicyResource = new DataPolicy("dataPolicyResource", DataPolicyArgs.builder()
        .dataPolicyId("string")
        .dataPolicyType("string")
        .location("string")
        .policyTag("string")
        .dataMaskingPolicy(DataPolicyDataMaskingPolicyArgs.builder()
            .predefinedExpression("string")
            .routine("string")
            .build())
        .project("string")
        .build());
    
    data_policy_resource = gcp.bigquerydatapolicy.DataPolicy("dataPolicyResource",
        data_policy_id="string",
        data_policy_type="string",
        location="string",
        policy_tag="string",
        data_masking_policy=gcp.bigquerydatapolicy.DataPolicyDataMaskingPolicyArgs(
            predefined_expression="string",
            routine="string",
        ),
        project="string")
    
    const dataPolicyResource = new gcp.bigquerydatapolicy.DataPolicy("dataPolicyResource", {
        dataPolicyId: "string",
        dataPolicyType: "string",
        location: "string",
        policyTag: "string",
        dataMaskingPolicy: {
            predefinedExpression: "string",
            routine: "string",
        },
        project: "string",
    });
    
    type: gcp:bigquerydatapolicy:DataPolicy
    properties:
        dataMaskingPolicy:
            predefinedExpression: string
            routine: string
        dataPolicyId: string
        dataPolicyType: string
        location: string
        policyTag: string
        project: string
    

    DataPolicy 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 DataPolicy resource accepts the following input properties:

    DataPolicyId string
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    DataPolicyType string
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    Location string
    The name of the location of the data policy.
    PolicyTag string
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    DataMaskingPolicy DataPolicyDataMaskingPolicy
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    DataPolicyId string
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    DataPolicyType string
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    Location string
    The name of the location of the data policy.
    PolicyTag string
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    DataMaskingPolicy DataPolicyDataMaskingPolicyArgs
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    dataPolicyId String
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    dataPolicyType String
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location String
    The name of the location of the data policy.
    policyTag String
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    dataMaskingPolicy DataPolicyDataMaskingPolicy
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    dataPolicyId string
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    dataPolicyType string
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location string
    The name of the location of the data policy.
    policyTag string
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    dataMaskingPolicy DataPolicyDataMaskingPolicy
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    data_policy_id str
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    data_policy_type str
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location str
    The name of the location of the data policy.
    policy_tag str
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    data_masking_policy DataPolicyDataMaskingPolicyArgs
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    dataPolicyId String
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    dataPolicyType String
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location String
    The name of the location of the data policy.
    policyTag String
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    dataMaskingPolicy Property Map
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.

    Look up Existing DataPolicy Resource

    Get an existing DataPolicy 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?: DataPolicyState, opts?: CustomResourceOptions): DataPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            data_masking_policy: Optional[DataPolicyDataMaskingPolicyArgs] = None,
            data_policy_id: Optional[str] = None,
            data_policy_type: Optional[str] = None,
            location: Optional[str] = None,
            name: Optional[str] = None,
            policy_tag: Optional[str] = None,
            project: Optional[str] = None) -> DataPolicy
    func GetDataPolicy(ctx *Context, name string, id IDInput, state *DataPolicyState, opts ...ResourceOption) (*DataPolicy, error)
    public static DataPolicy Get(string name, Input<string> id, DataPolicyState? state, CustomResourceOptions? opts = null)
    public static DataPolicy get(String name, Output<String> id, DataPolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    DataMaskingPolicy DataPolicyDataMaskingPolicy
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    DataPolicyId string
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    DataPolicyType string
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    Location string
    The name of the location of the data policy.
    Name string
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    PolicyTag string
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    DataMaskingPolicy DataPolicyDataMaskingPolicyArgs
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    DataPolicyId string
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    DataPolicyType string
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    Location string
    The name of the location of the data policy.
    Name string
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    PolicyTag string
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    dataMaskingPolicy DataPolicyDataMaskingPolicy
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    dataPolicyId String
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    dataPolicyType String
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location String
    The name of the location of the data policy.
    name String
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    policyTag String
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    dataMaskingPolicy DataPolicyDataMaskingPolicy
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    dataPolicyId string
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    dataPolicyType string
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location string
    The name of the location of the data policy.
    name string
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    policyTag string
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    data_masking_policy DataPolicyDataMaskingPolicyArgs
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    data_policy_id str
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    data_policy_type str
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location str
    The name of the location of the data policy.
    name str
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    policy_tag str
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    dataMaskingPolicy Property Map
    The data masking policy that specifies the data masking rule to use. Structure is documented below.
    dataPolicyId String
    User-assigned (human readable) ID of the data policy that needs to be unique within a project. Used as {dataPolicyId} in part of the resource name.
    dataPolicyType String
    The enrollment level of the service. Possible values are: COLUMN_LEVEL_SECURITY_POLICY, DATA_MASKING_POLICY.


    location String
    The name of the location of the data policy.
    name String
    Resource name of this data policy, in the format of projects/{project_number}/locations/{locationId}/dataPolicies/{dataPolicyId}.
    policyTag String
    Policy tag resource name, in the format of projects/{project_number}/locations/{locationId}/taxonomies/{taxonomyId}/policyTags/{policyTag_id}.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Supporting Types

    DataPolicyDataMaskingPolicy, DataPolicyDataMaskingPolicyArgs

    PredefinedExpression string
    The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. Possible values are: SHA256, ALWAYS_NULL, DEFAULT_MASKING_VALUE, LAST_FOUR_CHARACTERS, FIRST_FOUR_CHARACTERS, EMAIL_MASK, DATE_YEAR_MASK.
    Routine string
    The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{projectNumber}/datasets/{dataset_id}/routines/{routine_id}.
    PredefinedExpression string
    The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. Possible values are: SHA256, ALWAYS_NULL, DEFAULT_MASKING_VALUE, LAST_FOUR_CHARACTERS, FIRST_FOUR_CHARACTERS, EMAIL_MASK, DATE_YEAR_MASK.
    Routine string
    The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{projectNumber}/datasets/{dataset_id}/routines/{routine_id}.
    predefinedExpression String
    The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. Possible values are: SHA256, ALWAYS_NULL, DEFAULT_MASKING_VALUE, LAST_FOUR_CHARACTERS, FIRST_FOUR_CHARACTERS, EMAIL_MASK, DATE_YEAR_MASK.
    routine String
    The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{projectNumber}/datasets/{dataset_id}/routines/{routine_id}.
    predefinedExpression string
    The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. Possible values are: SHA256, ALWAYS_NULL, DEFAULT_MASKING_VALUE, LAST_FOUR_CHARACTERS, FIRST_FOUR_CHARACTERS, EMAIL_MASK, DATE_YEAR_MASK.
    routine string
    The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{projectNumber}/datasets/{dataset_id}/routines/{routine_id}.
    predefined_expression str
    The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. Possible values are: SHA256, ALWAYS_NULL, DEFAULT_MASKING_VALUE, LAST_FOUR_CHARACTERS, FIRST_FOUR_CHARACTERS, EMAIL_MASK, DATE_YEAR_MASK.
    routine str
    The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{projectNumber}/datasets/{dataset_id}/routines/{routine_id}.
    predefinedExpression String
    The available masking rules. Learn more here: https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options. Possible values are: SHA256, ALWAYS_NULL, DEFAULT_MASKING_VALUE, LAST_FOUR_CHARACTERS, FIRST_FOUR_CHARACTERS, EMAIL_MASK, DATE_YEAR_MASK.
    routine String
    The name of the BigQuery routine that contains the custom masking routine, in the format of projects/{projectNumber}/datasets/{dataset_id}/routines/{routine_id}.

    Import

    DataPolicy can be imported using any of these accepted formats:

    • projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}

    • {{project}}/{{location}}/{{data_policy_id}}

    • {{location}}/{{data_policy_id}}

    When using the pulumi import command, DataPolicy can be imported using one of the formats above. For example:

    $ pulumi import gcp:bigquerydatapolicy/dataPolicy:DataPolicy default projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}
    
    $ pulumi import gcp:bigquerydatapolicy/dataPolicy:DataPolicy default {{project}}/{{location}}/{{data_policy_id}}
    
    $ pulumi import gcp:bigquerydatapolicy/dataPolicy:DataPolicy default {{location}}/{{data_policy_id}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi