@@ -120,6 +120,12 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
120120 Optional : true ,
121121 ValidateFunc : validation .StringInSlice ([]string {"AtLeastOnce" , "Always" , "ResultCount" , "MissingData" }, false ),
122122 },
123+ "min_data_points" : {
124+ Type : schema .TypeInt ,
125+ Optional : true ,
126+ ValidateFunc : validation .IntBetween (1 , 100 ),
127+ Computed : true ,
128+ },
123129 "detection_method" : {
124130 Type : schema .TypeString ,
125131 Optional : true ,
@@ -446,26 +452,30 @@ var metricsStaticTriggerConditionSchema = map[string]*schema.Schema{
446452 "time_range" : & timeRangeSchema ,
447453 "occurrence_type" : & occurrenceTypeSchema ,
448454 "alert" : nested (false , schemaMap {
449- "threshold" : & thresholdSchema ,
450- "threshold_type" : & thresholdTypeSchema ,
455+ "threshold" : & thresholdSchema ,
456+ "threshold_type" : & thresholdTypeSchema ,
457+ "min_data_points" : & minDataPointsOptSchema ,
451458 }),
452459 "resolution" : nested (false , schemaMap {
453460 "threshold" : & thresholdSchema ,
454461 "threshold_type" : & thresholdTypeSchema ,
455462 "occurrence_type" : & occurrenceTypeOptSchema ,
463+ "min_data_points" : & minDataPointsOptSchema ,
456464 }),
457465 }, metricsStaticConditionCriticalOrWarningAtleastOneKeys ),
458466 "warning" : nestedWithAtleastOneOfKeys (true , schemaMap {
459467 "time_range" : & timeRangeSchema ,
460468 "occurrence_type" : & occurrenceTypeSchema ,
461469 "alert" : nested (false , schemaMap {
462- "threshold" : & thresholdSchema ,
463- "threshold_type" : & thresholdTypeSchema ,
470+ "threshold" : & thresholdSchema ,
471+ "threshold_type" : & thresholdTypeSchema ,
472+ "min_data_points" : & minDataPointsOptSchema ,
464473 }),
465474 "resolution" : nested (false , schemaMap {
466475 "threshold" : & thresholdSchema ,
467476 "threshold_type" : & thresholdTypeSchema ,
468477 "occurrence_type" : & occurrenceTypeOptSchema ,
478+ "min_data_points" : & minDataPointsOptSchema ,
469479 }),
470480 }, metricsStaticConditionCriticalOrWarningAtleastOneKeys ),
471481}
@@ -569,6 +579,13 @@ var occurrenceTypeOptSchema = schema.Schema{
569579 ValidateFunc : validation .StringInSlice ([]string {"AtLeastOnce" , "Always" }, false ),
570580}
571581
582+ var minDataPointsOptSchema = schema.Schema {
583+ Type : schema .TypeInt ,
584+ Optional : true ,
585+ Computed : true ,
586+ ValidateFunc : validation .IntBetween (1 , 100 ),
587+ }
588+
572589var windowSchema = schema.Schema {
573590 Type : schema .TypeInt ,
574591 Optional : true ,
@@ -763,6 +780,7 @@ func resourceSumologicMonitorsLibraryMonitorRead(d *schema.ResourceData, meta in
763780 "threshold" : t .Threshold ,
764781 "threshold_type" : t .ThresholdType ,
765782 "occurrence_type" : t .OccurrenceType ,
783+ "min_data_points" : t .MinDataPoints ,
766784 "trigger_source" : t .TriggerSource ,
767785 "detection_method" : t .DetectionMethod ,
768786 "resolution_window" : t .PositiveResolutionWindow (),
@@ -921,6 +939,7 @@ func getTriggers(d *schema.ResourceData) []TriggerCondition {
921939 TimeRange : triggerDict ["time_range" ].(string ),
922940 OccurrenceType : triggerDict ["occurrence_type" ].(string ),
923941 TriggerSource : triggerDict ["trigger_source" ].(string ),
942+ MinDataPoints : triggerDict ["min_data_points" ].(int ),
924943 DetectionMethod : triggerDict ["detection_method" ].(string ),
925944 ResolutionWindow : triggerDict ["resolution_window" ].(string ),
926945 }
@@ -1167,11 +1186,13 @@ func jsonToMetricsStaticConditionBlock(conditions []TriggerCondition) map[string
11671186 hasCritical = true
11681187 criticalDict ["time_range" ] = condition .PositiveTimeRange ()
11691188 criticalDict ["occurrence_type" ] = condition .OccurrenceType
1189+ criticalAlrt ["min_data_points" ] = condition .MinDataPoints
11701190 criticalAlrt ["threshold" ] = condition .Threshold
11711191 criticalAlrt ["threshold_type" ] = condition .ThresholdType
11721192 case "ResolvedCritical" :
11731193 hasCritical = true
11741194 criticalDict ["time_range" ] = condition .PositiveTimeRange ()
1195+ criticalRslv ["min_data_points" ] = condition .MinDataPoints
11751196 criticalRslv ["threshold" ] = condition .Threshold
11761197 criticalRslv ["threshold_type" ] = condition .ThresholdType
11771198 if condition .OccurrenceType == "AtLeastOnce" {
@@ -1183,15 +1204,17 @@ func jsonToMetricsStaticConditionBlock(conditions []TriggerCondition) map[string
11831204 hasWarning = true
11841205 warningDict ["time_range" ] = condition .PositiveTimeRange ()
11851206 warningDict ["occurrence_type" ] = condition .OccurrenceType
1207+ warningAlrt ["min_data_points" ] = condition .MinDataPoints
11861208 warningAlrt ["threshold" ] = condition .Threshold
11871209 warningAlrt ["threshold_type" ] = condition .ThresholdType
11881210 case "ResolvedWarning" :
11891211 hasWarning = true
11901212 warningDict ["time_range" ] = condition .PositiveTimeRange ()
1213+ warningRslv ["min_data_points" ] = condition .MinDataPoints
11911214 warningRslv ["threshold" ] = condition .Threshold
11921215 warningRslv ["threshold_type" ] = condition .ThresholdType
11931216 if condition .OccurrenceType == "AtLeastOnce" {
1194- criticalRslv ["occurrence_type" ] = condition .OccurrenceType
1217+ warningRslv ["occurrence_type" ] = condition .OccurrenceType
11951218 } else {
11961219 // otherwise, the canonical translation is to leave out occurrenceType in the Resolved block
11971220 }
@@ -1501,6 +1524,8 @@ func (condition *TriggerCondition) readFrom(block map[string]interface{}) {
15011524 condition .ThresholdType = v .(string )
15021525 case "occurrence_type" :
15031526 condition .OccurrenceType = v .(string )
1527+ case "min_data_points" :
1528+ condition .MinDataPoints = v .(int )
15041529 case "trigger_source" :
15051530 condition .TriggerSource = v .(string )
15061531 case "detection_method" :
0 commit comments