Skip to content

Commit

Permalink
Skip duplication validation for empty cluster IDs (#9018) (#15940)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 22, 2023
1 parent ecdbc28 commit ff63d88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/9018.txt
Original file line number Diff line number Diff line change
@@ -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`
```
4 changes: 4 additions & 0 deletions google/services/bigtable/resource_bigtable_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit ff63d88

Please sign in to comment.