From e4af2d56f2cea006f9e7729be06567d136f86dce Mon Sep 17 00:00:00 2001 From: Anthony Stanton Date: Wed, 31 Aug 2016 17:44:09 +0200 Subject: [PATCH] fixup! Support for Librato Alerts and Services --- .../librato/resource_librato_alert.go | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/builtin/providers/librato/resource_librato_alert.go b/builtin/providers/librato/resource_librato_alert.go index e8364d84c..b524911fa 100644 --- a/builtin/providers/librato/resource_librato_alert.go +++ b/builtin/providers/librato/resource_librato_alert.go @@ -108,11 +108,32 @@ func resourceLibratoAlertConditionsHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) buf.WriteString(fmt.Sprintf("%s-", m["type"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m["metric_name"].(string))) + + source, present := m["source"] + if present { + buf.WriteString(fmt.Sprintf("%f-", source.(string))) + } + + detect_reset, present := m["detect_reset"] + if present { + buf.WriteString(fmt.Sprintf("%f-", detect_reset.(bool))) + } + + duration, present := m["duration"] + if present { + buf.WriteString(fmt.Sprintf("%f-", duration.(int))) + } + threshold, present := m["threshold"] if present { buf.WriteString(fmt.Sprintf("%f-", threshold.(float64))) } - buf.WriteString(fmt.Sprintf("%s-", m["metric_name"].(string))) + + summary_function, present := m["summary_function"] + if present { + buf.WriteString(fmt.Sprintf("%f-", summary_function.(string))) + } return hashcode.String(buf.String()) }