Skip to content

Commit

Permalink
Additionally check for start in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
therve committed Jul 27, 2020
1 parent 08160f3 commit 275c62d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions datadog/resource_datadog_downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ func resourceDatadogDowntime() *schema.Resource {
Optional: true,
DiffSuppressFunc: func(k, oldVal, newVal string, d *schema.ResourceData) bool {
_, startDatePresent := d.GetOk("start_date")
// If "start_date" is set, ignore diff for "start". If "start" isn't set, ignore diff because the value was set automatically.
return startDatePresent || (newVal == "0" && oldVal != "0")
now := time.Now().Unix()
// If "start_date" is set, ignore diff for "start". If "start" isn't set, ignore diff if start is in the past
return startDatePresent || (newVal == "0" && oldVal != "0" && int64(d.Get("start").(int)) < now)
},
Description: "Specify when this downtime should start",
},
Expand Down

0 comments on commit 275c62d

Please sign in to comment.