Table class

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

Example Usage

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

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",
            type: "intsum",
        },
        {
            family: "family-third",
            type: `        {
\\t\\t\\t\\t\\t\\"aggregateType\\": {
\\t\\t\\t\\t\\t\\t\\"max\\": {},
\\t\\t\\t\\t\\t\\t\\"inputType\\": {
\\t\\t\\t\\t\\t\\t\\t\\"int64Type\\": {
\\t\\t\\t\\t\\t\\t\\t\\t\\"encoding\\": {
\\t\\t\\t\\t\\t\\t\\t\\t\\t\\"bigEndianBytes\\": {}
\\t\\t\\t\\t\\t\\t\\t\\t}
\\t\\t\\t\\t\\t\\t\\t}
\\t\\t\\t\\t\\t\\t}
\\t\\t\\t\\t\\t}
\\t\\t\\t\\t}
`,
        },
    ],
    changeStreamRetention: "24h0m0s",
    automatedBackupPolicy: {
        retentionPeriod: "72h0m0s",
        frequency: "24h0m0s",
    },
});
import pulumi
import pulumi_gcp as gcp

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",
            "type": "intsum",
        },
        {
            "family": "family-third",
            "type": """        {
\t\t\t\t\t\"aggregateType\": {
\t\t\t\t\t\t\"max\": {},
\t\t\t\t\t\t\"inputType\": {
\t\t\t\t\t\t\t\"int64Type\": {
\t\t\t\t\t\t\t\t\"encoding\": {
\t\t\t\t\t\t\t\t\t\"bigEndianBytes\": {}
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
""",
        },
    ],
    change_stream_retention="24h0m0s",
    automated_backup_policy={
        "retention_period": "72h0m0s",
        "frequency": "24h0m0s",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

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",
                Type = "intsum",
            },
            new Gcp.BigTable.Inputs.TableColumnFamilyArgs
            {
                Family = "family-third",
                Type = @"        {
\t\t\t\t\t\""aggregateType\"": {
\t\t\t\t\t\t\""max\"": {},
\t\t\t\t\t\t\""inputType\"": {
\t\t\t\t\t\t\t\""int64Type\"": {
\t\t\t\t\t\t\t\t\""encoding\"": {
\t\t\t\t\t\t\t\t\t\""bigEndianBytes\"": {}
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
",
            },
        },
        ChangeStreamRetention = "24h0m0s",
        AutomatedBackupPolicy = new Gcp.BigTable.Inputs.TableAutomatedBackupPolicyArgs
        {
            RetentionPeriod = "72h0m0s",
            Frequency = "24h0m0s",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigtable"
	"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
		}
		_, 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"),
					Type:   pulumi.String("intsum"),
				},
				&bigtable.TableColumnFamilyArgs{
					Family: pulumi.String("family-third"),
					Type: pulumi.String(`        {
\t\t\t\t\t\"aggregateType\": {
\t\t\t\t\t\t\"max\": {},
\t\t\t\t\t\t\"inputType\": {
\t\t\t\t\t\t\t\"int64Type\": {
\t\t\t\t\t\t\t\t\"encoding\": {
\t\t\t\t\t\t\t\t\t\"bigEndianBytes\": {}
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
`),
				},
			},
			ChangeStreamRetention: pulumi.String("24h0m0s"),
			AutomatedBackupPolicy: &bigtable.TableAutomatedBackupPolicyArgs{
				RetentionPeriod: pulumi.String("72h0m0s"),
				Frequency:       pulumi.String("24h0m0s"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

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"
    type   = "intsum"
  }
  column_families {
    family = "family-third"
    type   = "        {\n\\t\\t\\t\\t\\t\\\"aggregateType\\\": {\n\\t\\t\\t\\t\\t\\t\\\"max\\\": {},\n\\t\\t\\t\\t\\t\\t\\\"inputType\\\": {\n\\t\\t\\t\\t\\t\\t\\t\\\"int64Type\\\": {\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"encoding\\\": {\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"bigEndianBytes\\\": {}\n\\t\\t\\t\\t\\t\\t\\t\\t}\n\\t\\t\\t\\t\\t\\t\\t}\n\\t\\t\\t\\t\\t\\t}\n\\t\\t\\t\\t\\t}\n\\t\\t\\t\\t}\n"
  }
  change_stream_retention = "24h0m0s"
  automated_backup_policy = {
    retention_period = "72h0m0s"
    frequency        = "24h0m0s"
  }
}
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.inputs.TableAutomatedBackupPolicyArgs;
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")
                    .type("intsum")
                    .build(),
                TableColumnFamilyArgs.builder()
                    .family("family-third")
                    .type("""
        {
\t\t\t\t\t\"aggregateType\": {
\t\t\t\t\t\t\"max\": {},
\t\t\t\t\t\t\"inputType\": {
\t\t\t\t\t\t\t\"int64Type\": {
\t\t\t\t\t\t\t\t\"encoding\": {
\t\t\t\t\t\t\t\t\t\"bigEndianBytes\": {}
\t\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t}
                    """)
                    .build())
            .changeStreamRetention("24h0m0s")
            .automatedBackupPolicy(TableAutomatedBackupPolicyArgs.builder()
                .retentionPeriod("72h0m0s")
                .frequency("24h0m0s")
                .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
          type: intsum
        - family: family-third
          type: |2
                    {
            \t\t\t\t\t\"aggregateType\": {
            \t\t\t\t\t\t\"max\": {},
            \t\t\t\t\t\t\"inputType\": {
            \t\t\t\t\t\t\t\"int64Type\": {
            \t\t\t\t\t\t\t\t\"encoding\": {
            \t\t\t\t\t\t\t\t\t\"bigEndianBytes\": {}
            \t\t\t\t\t\t\t\t}
            \t\t\t\t\t\t\t}
            \t\t\t\t\t\t}
            \t\t\t\t\t}
            \t\t\t\t}
      changeStreamRetention: 24h0m0s
      automatedBackupPolicy:
        retentionPeriod: 72h0m0s
        frequency: 24h0m0s

Import

> Fields affected by import The following fields can't be read and will show diffs if set in config when imported: splitKeys

Bigtable Tables can be imported using any of these accepted formats:

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

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

$ pulumi import gcp:bigtable/table:Table default projects/{{project}}/instances/{{instance_name}}/tables/{{name}}
$ pulumi import gcp:bigtable/table:Table default {{project}}/{{instance_name}}/{{name}}
$ pulumi import gcp:bigtable/table:Table default {{instance_name}}/{{name}}

Constructors

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

Properties

automatedBackupPolicy ↔ Output<TableAutomatedBackupPolicy>
Defines an automated backup policy for a table, specified by retentionPeriod and frequency. To create a table with automated backup disabled, either omit the automatedBackupPolicy argument or set both retentionPeriod and frequency to "0". To disable automated backup on an existing table that has automated backup enabled, set both retentionPeriod and frequency to "0". When updating an existing table, change the retentionPeriod or frequency by setting the respective property to a non-zero value. The policy also accepts an optional locations list to specify backup storage locations; if locations is omitted, the policy defaults to all clusters in the instance. If the automatedBackupPolicy argument is not provided on update, the resource's automated backup policy will not be modified.
latefinal
changeStreamRetention ↔ Output<String>
Duration to retain change stream data for the table. Set to 0 to disable. Must be between 1 and 7 days.
latefinal
childResources → Set<Resource>
finalinherited
columnFamilies ↔ Output<List<TableColumnFamily>?>
A group of columns within a table which share a common configuration. This can be specified multiple times. Structure is documented below.
latefinal
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, deletion protection will be set to UNPROTECTED.
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.
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 table. 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
rowKeySchema ↔ Output<String?>
Defines the row key schema of a table. To create or update a table with a row key schema, specify this argument. Note that in-place update is not supported, and any in-place modification to the schema will lead to failure. To update a schema, please clear it (by omitting the field), and update the resource again with a new schema.\n
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
splitKeys ↔ Output<List<String>?>
A list of predefined keys to split the table on. > Warning: Modifying the splitKeys of an existing table will cause the provider to delete/recreate the entire gcp.bigtable.Table resource.
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, {TableState? state, CustomResourceOptions? options}) → Table
Gets an existing Table resource's state with the given name and id.