Google Cloud Bigtable Instance

This page shows how to write Terraform for Cloud Bigtable Instance and write them securely.

google_bigtable_instance (Terraform)

The Instance in Cloud Bigtable can be configured in Terraform with the resource name google_bigtable_instance. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L10
resource "google_bigtable_instance" "scale_bigtable" {
  # Arguments
  project = var.project  # TODO: Move project central to provider
  name = "scale-bigtable"
  deletion_protection = false

bigtable.tf#L1
resource "google_bigtable_instance" "production-instance" {
  name                = var.config["name"]
  deletion_protection = var.config["deletion_protection"]
  cluster {
    cluster_id   = var.config["cluster_id"]
    num_nodes    = var.config["num_nodes"]
main.tf#L1
resource "google_bigtable_instance" "development-instance" {
  name          = var.name
  instance_type = var.instance_type

  cluster {
    cluster_id   = var.cluster_id
bigtable.tf#L1
resource "google_bigtable_instance" "production-instance" {
  name                = var.config["name"]
  deletion_protection = var.config["deletion_protection"]
  cluster {
    cluster_id   = var.config["cluster_id"]
    num_nodes    = var.config["num_nodes"]
bigtable.tf#L1
resource "google_bigtable_instance" "instance" {
  name = "tango-instance"

  cluster {
    cluster_id   = "tango-instance-cluster"
    num_nodes    = 1

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Whether or not to allow Terraform to destroy the instance. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply that would delete the instance will fail.

The human-readable display name of the Bigtable instance. Defaults to the instance name.

The instance type to create. One of "DEVELOPMENT" or "PRODUCTION". Defaults to "PRODUCTION".

  • labels optional - map from string to string

A mapping of labels to assign to the resource.

The name (also called Instance Id in the Cloud Console) of the Cloud Bigtable instance.

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • cluster list block

    The ID of the Cloud Bigtable cluster.

    The number of nodes in your Cloud Bigtable cluster. Required, with a minimum of 1 for a PRODUCTION instance. Must be left unset for a DEVELOPMENT instance.

    The storage type to use. One of "SSD" or "HDD". Defaults to "SSD".

    • zone optional computed - string

    The zone to create the Cloud Bigtable cluster in. Each cluster must have a different zone in the same region. Zones that support Bigtable instances are noted on the Cloud Bigtable locations page.

Explanation in Terraform Registry

Creates a Google Bigtable instance. For more information see:

  • API documentation
  • How-to Guides
    • Official Documentation ->Note: It is strongly recommended to set lifecycle { prevent_destroy = true } on instances in order to prevent accidental data loss. See Terraform docs for more information on lifecycle parameters. ->Note: On newer versions of the provider, you must explicitly set deletion_protection=false (and run terraform apply to write the field to state) in order to destroy an instance. It is recommended to not set this field (or set it to true) until you're ready to destroy.

Frequently asked questions

What is Google Cloud Bigtable Instance?

Google Cloud Bigtable Instance is a resource for Cloud Bigtable of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud Bigtable Instance?

For Terraform, the codecentric/gcloud-scale-dev-friday, alisahp/gcp and marcelopicarelli/google-datalake source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.