55 "strings"
66
77 "github.com/hashicorp/terraform-plugin-sdk/helper/schema"
8+ "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
89)
910
1011func resourceSumologicMonitorsLibraryMonitor () * schema.Resource {
@@ -90,30 +91,36 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
9091 "trigger_type" : {
9192 Type : schema .TypeString ,
9293 Optional : true ,
94+ ValidateFunc : validation .StringInSlice ([]string {"Critical" ,"Warning" ,"MissingData" ,"ResolvedCritical" ,"ResolvedWarning" ,"ResolvedMissingData" }, false ),
9395 },
9496 "threshold" : {
9597 Type : schema .TypeFloat ,
9698 Optional : true ,
9799 },
98100 "threshold_type" : {
99- Type : schema .TypeString ,
100- Optional : true ,
101+ Type : schema .TypeString ,
102+ Optional : true ,
103+ ValidateFunc : validation .StringInSlice ([]string {"LessThan" , "LessThanOrEqual" , "GreaterThan" , "GreaterThanOrEqual" }, false ),
101104 },
102105 "time_range" : {
103106 Type : schema .TypeString ,
104107 Optional : true ,
108+ ValidateFunc : validation .StringInSlice ([]string {"5m" ,"10m" ,"15m" ,"30m" ,"60m" ,"1h" ,"3h" ,"6h" ,"12h" ,"24h" ,"1d" }, false ),
105109 },
106110 "trigger_source" : {
107111 Type : schema .TypeString ,
108112 Optional : true ,
113+ ValidateFunc : validation .StringInSlice ([]string {"AllTimeSeries" ,"AnyTimeSeries" ,"AllResults" }, false ),
109114 },
110115 "occurrence_type" : {
111116 Type : schema .TypeString ,
112117 Optional : true ,
118+ ValidateFunc : validation .StringInSlice ([]string {"AtLeastOnce" ,"Always" ,"ResultCount" ,"MissingData" }, false ),
113119 },
114120 "detection_method" : {
115121 Type : schema .TypeString ,
116122 Optional : true ,
123+ ValidateFunc : validation .StringInSlice ([]string {"StaticCondition" ,"LogsStaticCondition" ,"MetricsStaticCondition" ,"LogsOutlierCondition" ,"MetricsOutlierCondition" ,"LogsMissingDataCondition" ,"MetricsMissingDataCondition" }, false ),
117124 },
118125 },
119126 },
@@ -142,6 +149,7 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
142149 Type : schema .TypeString ,
143150 Optional : true ,
144151 Computed : true ,
152+ ValidateFunc : validation .StringInSlice ([]string {"Email" ,"AWSLambda" ,"AzureFunctions" ,"Datadog" ,"HipChat" ,"Jira" ,"NewRelic" ,"Opsgenie" ,"PagerDuty" ,"Slack" ,"MicrosoftTeams" ,"Webhook" }, false ),
145153 },
146154 "subject" : {
147155 Type : schema .TypeString ,
@@ -198,6 +206,7 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
198206 "monitor_type" : {
199207 Type : schema .TypeString ,
200208 Required : true ,
209+ ValidateFunc : validation .StringInSlice ([]string {"Logs" , "Metrics" }, false ),
201210 },
202211
203212 "is_locked" : {
@@ -223,6 +232,7 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
223232 Type : schema .TypeString ,
224233 Optional : true ,
225234 Default : "MonitorsLibraryMonitor" ,
235+ ValidateFunc : validation .StringInSlice ([]string {"MonitorsLibraryMonitor" , "MonitorsLibraryFolder" }, false ),
226236 },
227237
228238 "modified_by" : {
0 commit comments