From 0b582cca87cdfa32747322885415c8dfcf64d75b Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 22 Sep 2023 00:45:41 +0000 Subject: [PATCH] Skip duplication validation for empty cluster IDs (#9018) 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) }