Skip to content

Commit fd87bf4

Browse files
author
Uddipaan Hazarika
committed
added fix for cascading failure
1 parent 179a882 commit fd87bf4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

internal/provider/commons.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var updatableVdbKeys = map[string]bool{
5151
"new_dbid": true,
5252
"mount_point": true,
5353
"tags": true,
54+
"database_name": true,
5455
}
5556

5657
var isDestructiveVdbUpdate = map[string]bool{

internal/provider/resource_vdb.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ func resourceVdb() *schema.Resource {
9292
},
9393
"database_name": {
9494
Type: schema.TypeString,
95-
Optional: true,
9695
Computed: true,
96+
Optional: true,
9797
},
9898
"cdb_id": {
9999
Type: schema.TypeString,
@@ -1594,6 +1594,7 @@ func resourceVdbRead(ctx context.Context, d *schema.ResourceData, meta interface
15941594
if !*result.IsAppdata {
15951595
d.Set("database_name", result.GetDatabaseName())
15961596
}
1597+
15971598
d.Set("tags", flattenTags(result.GetTags()))
15981599
d.Set("vdb_restart", result.GetVdbRestart())
15991600

internal/provider/utility.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io"
66
"math"
77
"net/http"
8+
"reflect"
89
"strconv"
910
"time"
1011

@@ -285,7 +286,9 @@ func enableVDB(ctx context.Context, client *dctapi.APIClient, vdbId string) diag
285286
func revertChanges(d *schema.ResourceData, changedKeys []string) {
286287
for _, key := range changedKeys {
287288
old, _ := d.GetChange(key)
288-
d.Set(key, old)
289+
if !reflect.ValueOf(old).IsZero() { // so that a previously optional param is not set to blank erroraneously
290+
d.Set(key, old)
291+
}
289292
}
290293
}
291294

0 commit comments

Comments
 (0)