Skip to content

Commit 04cc973

Browse files
authored
Merge pull request #420 from SumoLogic/tarun_more_monitors_validations
Adding validations for `name`, `description` and `payload_override` in monitors resource
2 parents b12d273 + dd56e46 commit 04cc973

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sumologic/resource_sumologic_monitors_library_monitor.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
254254
Optional: true,
255255
},
256256
"payload_override": {
257-
Type: schema.TypeString,
258-
Optional: true,
257+
Type: schema.TypeString,
258+
Optional: true,
259+
ValidateFunc: validation.StringIsJSON,
259260
},
260261
},
261262
},
@@ -272,8 +273,9 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
272273
},
273274

274275
"description": {
275-
Type: schema.TypeString,
276-
Optional: true,
276+
Type: schema.TypeString,
277+
Optional: true,
278+
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[^\ ].*[^\ ]$`), "description must not contain leading or trailing spaces"),
277279
},
278280

279281
"created_at": {
@@ -328,8 +330,9 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
328330
},
329331

330332
"name": {
331-
Type: schema.TypeString,
332-
Required: true,
333+
Type: schema.TypeString,
334+
Required: true,
335+
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[^\ ].*[^\ ]$`), "name must not contain leading or trailing spaces"),
333336
},
334337

335338
"post_request_map": {

0 commit comments

Comments
 (0)