AuthorizedView class

Creates a Google Cloud Bigtable authorized view inside a table. For more information see the official documentation and API.

> Note: It is strongly recommended to set lifecycle { preventDestroy = true } on authorized views in order to prevent accidental data loss. See Terraform docs for more information on lifecycle parameters.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as std from "@pulumi/std";

const instance = new gcp.bigtable.Instance("instance", {
    name: "tf-instance",
    clusters: [{
        clusterId: "tf-instance-cluster",
        zone: "us-central1-b",
        numNodes: 3,
        storageType: "HDD",
    }],
});
const table = new gcp.bigtable.Table("table", {
    name: "tf-table",
    instanceName: instance.name,
    splitKeys: [
        "a",
        "b",
        "c",
    ],
    columnFamilies: [
        {
            family: "family-first",
        },
        {
            family: "family-second",
        },
    ],
    changeStreamRetention: "24h0m0s",
});
const authorizedView = new gcp.bigtable.AuthorizedView("authorized_view", {
    name: "tf-authorized-view",
    instanceName: instance.name,
    tableName: table.name,
    subsetView: {
        rowPrefixes: [std.base64encode({
            input: "prefix#",
        }).then(invoke => invoke.result)],
        familySubsets: [
            {
                familyName: "family-first",
                qualifiers: [
                    std.base64encode({
                        input: "qualifier",
                    }).then(invoke => invoke.result),
                    std.base64encode({
                        input: "qualifier-second",
                    }).then(invoke => invoke.result),
                ],
            },
            {
                familyName: "family-second",
                qualifierPrefixes: [""],
            },
        ],
    },
});
import pulumi
import pulumi_gcp as gcp
import pulumi_std as std

instance = gcp.bigtable.Instance("instance",
    name="tf-instance",
    clusters=[{
        "cluster_id": "tf-instance-cluster",
        "zone": "us-central1-b",
        "num_nodes": 3,
        "storage_type": "HDD",
    }])
table = gcp.bigtable.Table("table",
    name="tf-table",
    instance_name=instance.name,
    split_keys=[
        "a",
        "b",
        "c",
    ],
    column_families=[
        {
            "family": "family-first",
        },
        {
            "family": "family-second",
        },
    ],
    change_stream_retention="24h0m0s")
authorized_view = gcp.bigtable.AuthorizedView("authorized_view",
    name="tf-authorized-view",
    instance_name=instance.name,
    table_name=table.name,
    subset_view={
        "row_prefixes": [std.base64encode(input="prefix#").result],
        "family_subsets": [
            {
                "family_name": "family-first",
                "qualifiers": [
                    std.base64encode(input="qualifier").result,
                    std.base64encode(input="qualifier-second").result,
                ],
            },
            {
                "family_name": "family-second",
                "qualifier_prefixes": [""],
            },
        ],
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() =>
{
    var instance = new Gcp.BigTable.Instance("instance", new()
    {
        Name = "tf-instance",
        Clusters = new[]
        {
            new Gcp.BigTable.Inputs.InstanceClusterArgs
            {
                ClusterId = "tf-instance-cluster",
                Zone = "us-central1-b",
                NumNodes = 3,
                StorageType = "HDD",
            },
        },
    });

    var table = new Gcp.BigTable.Table("table", new()
    {
        Name = "tf-table",
        InstanceName = instance.Name,
        SplitKeys = new[]
        {
            "a",
            "b",
            "c",
        },
        ColumnFamilies = new[]
        {
            new Gcp.BigTable.Inputs.TableColumnFamilyArgs
            {
                Family = "family-first",
            },
            new Gcp.BigTable.Inputs.TableColumnFamilyArgs
            {
                Family = "family-second",
            },
        },
        ChangeStreamRetention = "24h0m0s",
    });

    var authorizedView = new Gcp.BigTable.AuthorizedView("authorized_view", new()
    {
        Name = "tf-authorized-view",
        InstanceName = instance.Name,
        TableName = table.Name,
        SubsetView = new Gcp.BigTable.Inputs.AuthorizedViewSubsetViewArgs
        {
            RowPrefixes = new[]
            {
                Std.Base64encode.Invoke(new()
                {
                    Input = "prefix#",
                }).Apply(invoke => invoke.Result),
            },
            FamilySubsets = new[]
            {
                new Gcp.BigTable.Inputs.AuthorizedViewSubsetViewFamilySubsetArgs
                {
                    FamilyName = "family-first",
                    Qualifiers = new[]
                    {
                        Std.Base64encode.Invoke(new()
                        {
                            Input = "qualifier",
                        }).Apply(invoke => invoke.Result),
                        Std.Base64encode.Invoke(new()
                        {
                            Input = "qualifier-second",
                        }).Apply(invoke => invoke.Result),
                    },
                },
                new Gcp.BigTable.Inputs.AuthorizedViewSubsetViewFamilySubsetArgs
                {
                    FamilyName = "family-second",
                    QualifierPrefixes = new[]
                    {
                        "",
                    },
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigtable"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		instance, err := bigtable.NewInstance(ctx, "instance", &bigtable.InstanceArgs{
			Name: pulumi.String("tf-instance"),
			Clusters: bigtable.InstanceClusterArray{
				&bigtable.InstanceClusterArgs{
					ClusterId:   pulumi.String("tf-instance-cluster"),
					Zone:        pulumi.String("us-central1-b"),
					NumNodes:    pulumi.Int(3),
					StorageType: pulumi.String("HDD"),
				},
			},
		})
		if err != nil {
			return err
		}
		table, err := bigtable.NewTable(ctx, "table", &bigtable.TableArgs{
			Name:         pulumi.String("tf-table"),
			InstanceName: instance.Name,
			SplitKeys: pulumi.StringArray{
				pulumi.String("a"),
				pulumi.String("b"),
				pulumi.String("c"),
			},
			ColumnFamilies: bigtable.TableColumnFamilyArray{
				&bigtable.TableColumnFamilyArgs{
					Family: pulumi.String("family-first"),
				},
				&bigtable.TableColumnFamilyArgs{
					Family: pulumi.String("family-second"),
				},
			},
			ChangeStreamRetention: pulumi.String("24h0m0s"),
		})
		if err != nil {
			return err
		}
		invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
			Input: "prefix#",
		}, nil)
		if err != nil {
			return err
		}
		invokeBase64encode1, err := std.Base64encode(ctx, &std.Base64encodeArgs{
			Input: "qualifier",
		}, nil)
		if err != nil {
			return err
		}
		invokeBase64encode2, err := std.Base64encode(ctx, &std.Base64encodeArgs{
			Input: "qualifier-second",
		}, nil)
		if err != nil {
			return err
		}
		_, err = bigtable.NewAuthorizedView(ctx, "authorized_view", &bigtable.AuthorizedViewArgs{
			Name:         pulumi.String("tf-authorized-view"),
			InstanceName: instance.Name,
			TableName:    table.Name,
			SubsetView: &bigtable.AuthorizedViewSubsetViewArgs{
				RowPrefixes: pulumi.StringArray{
					pulumi.String(invokeBase64encode.Result),
				},
				FamilySubsets: bigtable.AuthorizedViewSubsetViewFamilySubsetArray{
					&bigtable.AuthorizedViewSubsetViewFamilySubsetArgs{
						FamilyName: pulumi.String("family-first"),
						Qualifiers: pulumi.StringArray{
							pulumi.String(invokeBase64encode1.Result),
							pulumi.String(invokeBase64encode2.Result),
						},
					},
					&bigtable.AuthorizedViewSubsetViewFamilySubsetArgs{
						FamilyName: pulumi.String("family-second"),
						QualifierPrefixes: pulumi.StringArray{
							pulumi.String(""),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
    std = {
      source = "pulumi/std"
    }
  }
}

resource "gcp_bigtable_instance" "instance" {
  name = "tf-instance"
  clusters {
    cluster_id   = "tf-instance-cluster"
    zone         = "us-central1-b"
    num_nodes    = 3
    storage_type = "HDD"
  }
}
resource "gcp_bigtable_table" "table" {
  name          = "tf-table"
  instance_name = gcp_bigtable_instance.instance.name
  split_keys    = ["a", "b", "c"]
  column_families {
    family = "family-first"
  }
  column_families {
    family = "family-second"
  }
  change_stream_retention = "24h0m0s"
}
resource "gcp_bigtable_authorizedview" "authorized_view" {
  name          = "tf-authorized-view"
  instance_name = gcp_bigtable_instance.instance.name
  table_name    = gcp_bigtable_table.table.name
  subset_view = {
    row_prefixes = [base64encode("prefix#")]
    family_subsets = [{
      "familyName" = "family-first"
      "qualifiers" = [base64encode("qualifier"), base64encode("qualifier-second")]
      }, {
      "familyName"        = "family-second"
      "qualifierPrefixes" = [""]
    }]
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.bigtable.Instance;
import com.pulumi.gcp.bigtable.InstanceArgs;
import com.pulumi.gcp.bigtable.inputs.InstanceClusterArgs;
import com.pulumi.gcp.bigtable.Table;
import com.pulumi.gcp.bigtable.TableArgs;
import com.pulumi.gcp.bigtable.inputs.TableColumnFamilyArgs;
import com.pulumi.gcp.bigtable.AuthorizedView;
import com.pulumi.gcp.bigtable.AuthorizedViewArgs;
import com.pulumi.gcp.bigtable.inputs.AuthorizedViewSubsetViewArgs;
import com.pulumi.gcp.bigtable.inputs.AuthorizedViewSubsetViewFamilySubsetArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.Base64encodeArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 instance = new Instance("instance", InstanceArgs.builder()
            .name("tf-instance")
            .clusters(InstanceClusterArgs.builder()
                .clusterId("tf-instance-cluster")
                .zone("us-central1-b")
                .numNodes(3)
                .storageType("HDD")
                .build())
            .build());

        var table = new Table("table", TableArgs.builder()
            .name("tf-table")
            .instanceName(instance.name())
            .splitKeys(
                "a",
                "b",
                "c")
            .columnFamilies(
                TableColumnFamilyArgs.builder()
                    .family("family-first")
                    .build(),
                TableColumnFamilyArgs.builder()
                    .family("family-second")
                    .build())
            .changeStreamRetention("24h0m0s")
            .build());

        var authorizedView = new AuthorizedView("authorizedView", AuthorizedViewArgs.builder()
            .name("tf-authorized-view")
            .instanceName(instance.name())
            .tableName(table.name())
            .subsetView(AuthorizedViewSubsetViewArgs.builder()
                .rowPrefixes(StdFunctions.base64encode(Base64encodeArgs.builder()
                    .input("prefix#")
                    .build()).result())
                .familySubsets(
                    AuthorizedViewSubsetViewFamilySubsetArgs.builder()
                        .familyName("family-first")
                        .qualifiers(
                            StdFunctions.base64encode(Base64encodeArgs.builder()
                                .input("qualifier")
                                .build()).result(),
                            StdFunctions.base64encode(Base64encodeArgs.builder()
                                .input("qualifier-second")
                                .build()).result())
                        .build(),
                    AuthorizedViewSubsetViewFamilySubsetArgs.builder()
                        .familyName("family-second")
                        .qualifierPrefixes("")
                        .build())
                .build())
            .build());

    }
}
resources:
  instance:
    type: gcp:bigtable:Instance
    properties:
      name: tf-instance
      clusters:
        - clusterId: tf-instance-cluster
          zone: us-central1-b
          numNodes: 3
          storageType: HDD
  table:
    type: gcp:bigtable:Table
    properties:
      name: tf-table
      instanceName: ${instance.name}
      splitKeys:
        - a
        - b
        - c
      columnFamilies:
        - family: family-first
        - family: family-second
      changeStreamRetention: 24h0m0s
  authorizedView:
    type: gcp:bigtable:AuthorizedView
    name: authorized_view
    properties:
      name: tf-authorized-view
      instanceName: ${instance.name}
      tableName: ${table.name}
      subsetView:
        rowPrefixes:
          - fn::invoke:
              function: std:base64encode
              arguments:
                input: prefix#
              return: result
        familySubsets:
          - familyName: family-first
            qualifiers:
              - fn::invoke:
                  function: std:base64encode
                  arguments:
                    input: qualifier
                  return: result
              - fn::invoke:
                  function: std:base64encode
                  arguments:
                    input: qualifier-second
                  return: result
          - familyName: family-second
            qualifierPrefixes:
              - ""

Import

Bigtable Authorized Views can be imported using any of these accepted formats:

  • projects/{{project}}/instances/{{instance_name}}/tables/{{table_name}}/authorizedViews/{{name}}
  • {{project}}/{{instance_name}}/{{table_name}}/{{name}}
  • {{instance_name}}/{{table_name}}/{{name}}

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

$ pulumi import gcp:bigtable/authorizedView:AuthorizedView default projects/{{project}}/instances/{{instance_name}}/tables/{{table_name}}/authorizedViews/{{name}}
$ pulumi import gcp:bigtable/authorizedView:AuthorizedView default {{project}}/{{instance_name}}/{{table_name}}/{{name}}
$ pulumi import gcp:bigtable/authorizedView:AuthorizedView default {{instance_name}}/{{table_name}}/{{name}}

Constructors

AuthorizedView(String name, {AuthorizedViewArgs? args, CustomResourceOptions? options})
Creates a new AuthorizedView. name The Pulumi resource name. args Arguments used to configure this AuthorizedView. The set of arguments for AuthorizedView. options Resource options controlling this resource's behavior.
AuthorizedView.reference(String urn)
Creates a typed reference to an existing AuthorizedView resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE". When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
deletionProtection ↔ Output<String>
A field to make the table protected against data loss i.e. when set to PROTECTED, deleting the table, the column families in the table, and the instance containing the table would be prohibited. If not provided, currently deletion protection will be set to UNPROTECTED as it is the API default value. Note this field configs the deletion protection provided by the API in the backend, and should not be confused with Terraform-side deletion protection.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
instanceName ↔ Output<String>
The name of the Bigtable instance in which the authorized view belongs.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
The name of the authorized view. Must be 1-50 characters and must only contain hyphens, underscores, periods, letters and numbers.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subsetView ↔ Output<AuthorizedViewSubsetView?>
An AuthorizedView permitting access to an explicit subset of a Table. Structure is documented below.
latefinal
tableName ↔ Output<String>
The name of the Bigtable table in which the authorized view belongs.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {AuthorizedViewState? state, CustomResourceOptions? options}) → AuthorizedView
Gets an existing AuthorizedView resource's state with the given name and id.