Skip to content

googleBigtableTable

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

-> Note: It is strongly recommended to set lifecycle {PreventDestroy =True } on tables in order to prevent accidental data loss. See Terraform docs for more information on lifecycle parameters.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleBigtableInstanceInstance =
  new google.bigtableInstance.BigtableInstance(this, "instance", {
    cluster: [
      {
        cluster_id: "tf-instance-cluster",
        num_nodes: 3,
        storage_type: "HDD",
        zone: "us-central1-b",
      },
    ],
    name: "tf-instance",
  });
googleBigtableInstanceInstance.addOverride("lifecycle", [
  {
    prevent_destroy: true,
  },
]);
const googleBigtableTableTable = new google.bigtableTable.BigtableTable(
  this,
  "table",
  {
    column_family: [
      {
        family: "family-first",
      },
      {
        family: "family-second",
      },
    ],
    instance_name: googleBigtableInstanceInstance.name,
    name: "tf-table",
    split_keys: ["a", "b", "c"],
  }
);
googleBigtableTableTable.addOverride("lifecycle", [
  {
    prevent_destroy: true,
  },
]);

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the table. Must be 1-50 characters and must only contain hyphens, underscores, periods, letters and numbers.

  • instanceName - (Required) The name of the Bigtable instance.

  • splitKeys - (Optional) A list of predefined keys to split the table on. !> Warning: Modifying the splitKeys of an existing table will cause Terraform to delete/recreate the entire googleBigtableTable resource.

  • columnFamily - (Optional) A group of columns within a table which share a common configuration. This can be specified multiple times. Structure is documented below.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • deletionProtection - (Optional) 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.


columnFamily supports the following arguments:

  • family - (Optional) The name of the column family.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/instances/{{instanceName}}/tables/{{name}}

Import

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

$ terraform import google_bigtable_table.default projects/{{project}}/instances/{{instance_name}}/tables/{{name}}
$ terraform import google_bigtable_table.default {{project}}/{{instance_name}}/{{name}}
$ terraform import google_bigtable_table.default {{instance_name}}/{{name}}

The following fields can't be read and will show diffs if set in config when imported:

  • splitKeys