Skip to content

Commit 0869efe

Browse files
Remove string concatenation in spanner DB update (#4294) (#2766)
Signed-off-by: Modular Magician <[email protected]>
1 parent df0f3af commit 0869efe

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

.changelog/4294.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
spanner: fixed an issue in `google_spanner_database` where multi-statement updates were not formatted correctly
3+
```

google-beta/resource_spanner_database.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"fmt"
2020
"log"
2121
"reflect"
22-
"strings"
2322
"time"
2423

2524
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -475,7 +474,7 @@ func resourceSpannerDatabaseUpdateEncoder(d *schema.ResourceData, meta interface
475474
updateDdls = append(updateDdls, newDdls[i].(string))
476475
}
477476

478-
obj["statements"] = strings.Join(updateDdls, ",")
477+
obj["statements"] = updateDdls
479478
delete(obj, "name")
480479
delete(obj, "instance")
481480
delete(obj, "extraStatements")

google-beta/resource_spanner_database_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ resource "google_spanner_database" "basic" {
109109
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
110110
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)",
111111
"CREATE TABLE t3 (t3 INT64 NOT NULL,) PRIMARY KEY(t3)",
112+
"CREATE TABLE t4 (t4 INT64 NOT NULL,) PRIMARY KEY(t4)",
112113
]
113114
deletion_protection = false
114115
}

0 commit comments

Comments
 (0)