gcp.bigquerydatapolicy.DataPolicy

Explore with Pulumi AI

A BigQuery Data Policy

To get more information about DataPolicy, see:

Example Usage

Bigquery Datapolicy Data Policy Basic

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("policyTag", new()
    {
        Taxonomy = taxonomy.Id,
        DisplayName = "Low security",
        Description = "A policy tag normally associated with low security items",
    });

    var dataPolicy = new Gcp.BigQueryDataPolicy.DataPolicy("dataPolicy", new()
    {
        Location = "us-central1",
        DataPolicyId = "data_policy",
        PolicyTag = policyTag.Name,
        DataPolicyType = "COLUMN_LEVEL_SECURITY_POLICY",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/bigquerydatapolicy"
	"github.com/pulumi/pulumi-gcp/sdk/v6/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, "policyTag", &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, "dataPolicy", &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
	})
}
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());

    }
}
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("policyTag",
    taxonomy=taxonomy.id,
    display_name="Low security",
    description="A policy tag normally associated with low security items")
data_policy = gcp.bigquerydatapolicy.DataPolicy("dataPolicy",
    location="us-central1",
    data_policy_id="data_policy",
    policy_tag=policy_tag.name,
    data_policy_type="COLUMN_LEVEL_SECURITY_POLICY")
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("policyTag", {
    taxonomy: taxonomy.id,
    displayName: "Low security",
    description: "A policy tag normally associated with low security items",
});
const dataPolicy = new gcp.bigquerydatapolicy.DataPolicy("dataPolicy", {
    location: "us-central1",
    dataPolicyId: "data_policy",
    policyTag: policyTag.name,
    dataPolicyType: "COLUMN_LEVEL_SECURITY_POLICY",
});
resources:
  dataPolicy:
    type: gcp:bigquerydatapolicy:DataPolicy
    properties:
      location: us-central1
      dataPolicyId: data_policy
      policyTag: ${policyTag.name}
      dataPolicyType: COLUMN_LEVEL_SECURITY_POLICY
  policyTag:
    type: gcp:datacatalog:PolicyTag
    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

Create DataPolicy Resource

new DataPolicy(name: string, args: DataPolicyArgs, opts?: CustomResourceOptions);
@overload
def DataPolicy(resource_name: 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,
               policy_tag: Optional[str] = None,
               project: Optional[str] = None)
@overload
def DataPolicy(resource_name: str,
               args: DataPolicyArgs,
               opts: Optional[ResourceOptions] = 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.

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.

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 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 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 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 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.

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 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 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 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 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.

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

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.

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.

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.

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.

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.

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.

Import

DataPolicy can be imported using any of these accepted formats

 $ 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}}

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.