Skip to content

Commit

Permalink
databases: ignore seconds in maintenance_window.hour (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething authored Dec 15, 2023
1 parent 506ad73 commit 556c2da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions digitalocean/database/resource_database_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ func ResourceDigitalOceanDatabaseCluster() *schema.Resource {
// Prevent a diff when seconds in response, e.g: "13:00" -> "13:00:00"
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
newSplit := strings.Split(new, ":")
oldSplit := strings.Split(old, ":")
if len(newSplit) == 3 {
newTrimed := strings.Join(newSplit[:2], ":")
return newTrimed == old
new = strings.Join(newSplit[:2], ":")
}
if len(oldSplit) == 3 {
old = strings.Join(oldSplit[:2], ":")
}
return old == new
},
Expand Down
2 changes: 1 addition & 1 deletion digitalocean/database/resource_database_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ resource "digitalocean_database_cluster" "foobar" {
maintenance_window {
day = "friday"
hour = "13:00:00"
hour = "13:00"
}
}`

Expand Down

0 comments on commit 556c2da

Please sign in to comment.