Skip to content

Invalid Bigtable instance_id length error in GCP terraform module #311

Description

@vijay-wandb

The Bigtable instance created using @danielpanzella Terraform GCP branch at SSI (link) threw an error due to an invalid instance_id length

│
│   with module.wandb.module.bigtable[0].google_bigtable_instance.default,
│   on terraform-google-wandb/modules/bigtable/main.tf line 5, in resource "google_bigtable_instance" "default":
│    5: resource "google_bigtable_instance" "default" {

Just a FYI: The customer's workaround involves padding the namespace to meet the required length, but this may not work for us.

 % git diff
diff --git a/modules/bigtable/main.tf b/modules/bigtable/main.tf
index a49c0fc..7bab270 100644
--- a/modules/bigtable/main.tf
+++ b/modules/bigtable/main.tf
@@ -3,7 +3,7 @@ locals {
 }

 resource "google_bigtable_instance" "default" {
-  name                = var.namespace
+  name                = coalesce(substr("${var.namespace}000000", 0, 6), "default")
   deletion_protection = var.deletion_protection
   force_destroy       = !var.deletion_protection

Metadata

Metadata

Assignees

Labels

Priority-P1High priority designation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions