From ff63d886520f6fd0223652c98883625713dd9d69 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 21 Sep 2023 20:45:53 -0400 Subject: [PATCH] Skip duplication validation for empty cluster IDs (#9018) (#15940) Signed-off-by: Modular Magician --- .changelog/9018.txt | 3 +++ google/services/bigtable/resource_bigtable_instance.go | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 .changelog/9018.txt diff --git a/.changelog/9018.txt b/.changelog/9018.txt new file mode 100644 index 00000000000..692abe54a3d --- /dev/null +++ b/.changelog/9018.txt @@ -0,0 +1,3 @@ +```release-note:bug +bigtable: fixed a bug where dynamically created clusters would incorrectly run into duplication error in `google_bigtable_instance` +``` diff --git a/google/services/bigtable/resource_bigtable_instance.go b/google/services/bigtable/resource_bigtable_instance.go index 651a7dbbd42..82ce2d28c77 100644 --- a/google/services/bigtable/resource_bigtable_instance.go +++ b/google/services/bigtable/resource_bigtable_instance.go @@ -545,6 +545,10 @@ func resourceBigtableInstanceUniqueClusterID(_ context.Context, diff *schema.Res for i := 0; i < newCount.(int); i++ { _, newId := diff.GetChange(fmt.Sprintf("cluster.%d.cluster_id", i)) clusterID := newId.(string) + // In case clusterID is empty, it is probably computed and this validation will be wrong. + if clusterID == "" { + continue + } if clusters[clusterID] { return fmt.Errorf("duplicated cluster_id: %q", clusterID) }