provider/datadog: fix code to match schema
On Create, notify_no_data was being ignored. On Read and Update, no_data_timeframe was being misused. There was also a redundant read of escalation_message on Create.
This commit is contained in:
parent
df4ccdf5fa
commit
bef1b58fda
|
@ -135,7 +135,7 @@ func buildMonitorStruct(d *schema.ResourceData) *datadog.Monitor {
|
||||||
}
|
}
|
||||||
o.Silenced = s
|
o.Silenced = s
|
||||||
}
|
}
|
||||||
if attr, ok := d.GetOk("notify_data"); ok {
|
if attr, ok := d.GetOk("notify_no_data"); ok {
|
||||||
o.NotifyNoData = attr.(bool)
|
o.NotifyNoData = attr.(bool)
|
||||||
}
|
}
|
||||||
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
||||||
|
@ -153,9 +153,6 @@ func buildMonitorStruct(d *schema.ResourceData) *datadog.Monitor {
|
||||||
if attr, ok := d.GetOk("escalation_message"); ok {
|
if attr, ok := d.GetOk("escalation_message"); ok {
|
||||||
o.EscalationMessage = attr.(string)
|
o.EscalationMessage = attr.(string)
|
||||||
}
|
}
|
||||||
if attr, ok := d.GetOk("escalation_message"); ok {
|
|
||||||
o.EscalationMessage = attr.(string)
|
|
||||||
}
|
|
||||||
if attr, ok := d.GetOk("include_tags"); ok {
|
if attr, ok := d.GetOk("include_tags"); ok {
|
||||||
o.IncludeTags = attr.(bool)
|
o.IncludeTags = attr.(bool)
|
||||||
}
|
}
|
||||||
|
@ -226,7 +223,7 @@ func resourceDatadogMonitorRead(d *schema.ResourceData, meta interface{}) error
|
||||||
d.Set("type", m.Type)
|
d.Set("type", m.Type)
|
||||||
d.Set("thresholds", m.Options.Thresholds)
|
d.Set("thresholds", m.Options.Thresholds)
|
||||||
d.Set("notify_no_data", m.Options.NotifyNoData)
|
d.Set("notify_no_data", m.Options.NotifyNoData)
|
||||||
d.Set("notify_no_data_timeframe", m.Options.NoDataTimeframe)
|
d.Set("no_data_timeframe", m.Options.NoDataTimeframe)
|
||||||
d.Set("renotify_interval", m.Options.RenotifyInterval)
|
d.Set("renotify_interval", m.Options.RenotifyInterval)
|
||||||
d.Set("notify_audit", m.Options.NotifyAudit)
|
d.Set("notify_audit", m.Options.NotifyAudit)
|
||||||
d.Set("timeout_h", m.Options.TimeoutH)
|
d.Set("timeout_h", m.Options.TimeoutH)
|
||||||
|
@ -275,7 +272,7 @@ func resourceDatadogMonitorUpdate(d *schema.ResourceData, meta interface{}) erro
|
||||||
if attr, ok := d.GetOk("notify_no_data"); ok {
|
if attr, ok := d.GetOk("notify_no_data"); ok {
|
||||||
o.NotifyNoData = attr.(bool)
|
o.NotifyNoData = attr.(bool)
|
||||||
}
|
}
|
||||||
if attr, ok := d.GetOk("notify_no_data_timeframe"); ok {
|
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
||||||
o.NoDataTimeframe = attr.(int)
|
o.NoDataTimeframe = attr.(int)
|
||||||
}
|
}
|
||||||
if attr, ok := d.GetOk("renotify_interval"); ok {
|
if attr, ok := d.GetOk("renotify_interval"); ok {
|
||||||
|
|
Loading…
Reference in New Issue