Skip to content

Commit

Permalink
datadog: Fix incorrect schema of monitor for 'silenced' (#12720)
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko authored Mar 15, 2017
1 parent 1df1c21 commit 8730bf1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions builtin/providers/datadog/resource_datadog_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,10 @@ func resourceDatadogMonitor() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
},
// TODO should actually be map[string]int
"silenced": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Elem: &schema.Schema{
Type: schema.TypeInt},
},
Elem: schema.TypeInt,
},
"include_tags": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -158,7 +153,7 @@ func buildMonitorStruct(d *schema.ResourceData) *datadog.Monitor {
s := make(map[string]int)
// TODO: this is not very defensive, test if we can fail on non int input
for k, v := range attr.(map[string]interface{}) {
s[k], _ = strconv.Atoi(v.(string))
s[k] = v.(int)
}
o.Silenced = s
}
Expand Down Expand Up @@ -364,7 +359,7 @@ func resourceDatadogMonitorUpdate(d *schema.ResourceData, meta interface{}) erro
// TODO: this is not very defensive, test if we can fail non int input
s := make(map[string]int)
for k, v := range attr.(map[string]interface{}) {
s[k], _ = strconv.Atoi(v.(string))
s[k] = v.(int)
}
o.Silenced = s
}
Expand Down

0 comments on commit 8730bf1

Please sign in to comment.