-
Notifications
You must be signed in to change notification settings - Fork 389
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
Ignore diff to start on downtime resource #597
Conversation
datadog/resource_datadog_downtime.go
Outdated
@@ -46,7 +46,7 @@ func resourceDatadogDowntime() *schema.Resource { | |||
Optional: true, | |||
DiffSuppressFunc: func(k, oldVal, newVal string, d *schema.ResourceData) bool { | |||
_, startDatePresent := d.GetOk("start_date") | |||
return startDatePresent | |||
return startDatePresent || (newVal == "0" && oldVal != "0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@therve can you add examples when the diff should (not) be supressed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return startDatePresent || (newVal == "0" && oldVal != "0") | |
// "start_date" is set or was previously set (oldVal != "0") and it is being removed (newVal == "0") | |
return startDatePresent || (oldVal != "0" && newVal == "0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment, let me know if it makes sense.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
If the start attributes generates a diff from a value to nothing, it means that the attribute was never set to being with. Let's ignore the diff in that case. Closes #507
1210ae1
to
08160f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well for previously created downtimes 👍
If the start attributes generates a diff from a value to nothing, it
means that the attribute was never set to being with. Let's ignore the
diff in that case.
Closes #507