Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

databases: ignore seconds in maintenance_window.hour #1094

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading