Skip to content

Commit 8c75636

Browse files
committed
add fix for dbVersions
1 parent a75d6e7 commit 8c75636

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
- Support BGP dynamic routing and allow customer to input PSK for IPSec tunnels
66
- ListInstanceConfig/Pools and ListAutoscalingConfiguration return tags
77

8+
### Fixed
9+
- Fix for dbSystem `db_version` causing unnecessary diffs on subsequent applies
10+
811
## 3.25.0 (May 15, 2019)
912

1013
### Added

oci/crud_helpers.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,11 @@ func FilterMissingResourceError(sync ResourceVoider, err *error) {
444444

445445
// In the Exadata case the service return the hostname provided by the service with a suffix
446446
func dbSystemHostnameDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool {
447-
return EqualIgnoreCaseSuppressDiff(key, old, new, d) || strings.HasPrefix(strings.ToLower(old), strings.ToLower(new))
447+
return EqualIgnoreCaseSuppressDiff(key, old, new, d) || newIsPrefixOfOldDiffSuppress(key, old, new, d)
448+
}
449+
450+
func NewIsPrefixOfOldDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool {
451+
return strings.HasPrefix(strings.ToLower(old), strings.ToLower(new))
448452
}
449453

450454
func EqualIgnoreCaseSuppressDiff(key string, old string, new string, d *schema.ResourceData) bool {

oci/database_db_home_resource.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ func DatabaseDbHomeResource() *schema.Resource {
185185
ForceNew: true,
186186
},
187187
"db_version": {
188-
Type: schema.TypeString,
189-
Optional: true,
190-
Computed: true,
191-
ForceNew: true,
188+
Type: schema.TypeString,
189+
Optional: true,
190+
Computed: true,
191+
ForceNew: true,
192+
DiffSuppressFunc: NewIsPrefixOfOldDiffSuppress,
192193
},
193194

194195
// Optional

oci/database_db_system_resource.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,11 @@ func DatabaseDbSystemResource() *schema.Resource {
218218

219219
// Optional
220220
"db_version": {
221-
Type: schema.TypeString,
222-
Optional: true,
223-
Computed: true,
224-
ForceNew: true,
221+
Type: schema.TypeString,
222+
Optional: true,
223+
Computed: true,
224+
ForceNew: true,
225+
DiffSuppressFunc: NewIsPrefixOfOldDiffSuppress,
225226
},
226227
"display_name": {
227228
Type: schema.TypeString,

0 commit comments

Comments
 (0)