@@ -135,10 +135,12 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
135135 "action_type" : {
136136 Type : schema .TypeString ,
137137 Optional : true ,
138+ Computed : true ,
138139 },
139140 "connection_type" : {
140141 Type : schema .TypeString ,
141142 Optional : true ,
143+ Computed : true ,
142144 },
143145 "subject" : {
144146 Type : schema .TypeString ,
@@ -183,7 +185,7 @@ func resourceSumologicMonitorsLibraryMonitor() *schema.Resource {
183185
184186 "description" : {
185187 Type : schema .TypeString ,
186- Required : true ,
188+ Optional : true ,
187189 },
188190
189191 "created_at" : {
@@ -405,14 +407,19 @@ func getNotifications(d *schema.ResourceData) []MonitorNotification {
405407 n := MonitorNotification {}
406408 rawNotificationAction := notificationDict ["notification" ].([]interface {})
407409 notificationActionDict := rawNotificationAction [0 ].(map [string ]interface {})
408- var connectionType string
409- var actionType string
410+ connectionType := ""
411+ actionType := ""
410412 log .Printf ("[ROHIT DEBUG] notificationActionDict: %v" , notificationActionDict )
411- if notificationActionDict ["connection_type" ] != nil {
413+ if notificationActionDict ["connection_type" ] != nil &&
414+ notificationActionDict ["connection_type" ] != "" {
412415 connectionType = notificationActionDict ["connection_type" ].(string )
416+ actionType = connectionType
417+ log .Printf ("[ROHIT DEBUG] actionType in if: %v" , actionType )
418+ log .Printf ("[ROHIT DEBUG] connectionType in if: %v" , connectionType )
413419 } else {
414420 // for backwards compatibility
415421 actionType = notificationActionDict ["action_type" ].(string )
422+ log .Printf ("[ROHIT DEBUG] actionType in else: %v" , actionType )
416423 connectionType = actionType
417424 // convert from old action_type name to new connection_type name if applicable
418425 if connectionType == "EmailAction" {
@@ -421,9 +428,13 @@ func getNotifications(d *schema.ResourceData) []MonitorNotification {
421428 if connectionType == "NamedConnectionAction" {
422429 connectionType = "Webhook"
423430 }
431+ log .Printf ("[ROHIT DEBUG] connectionType in else: %v" , connectionType )
424432 }
433+ log .Printf ("[ROHIT DEBUG] actionType: %v" , actionType )
434+ log .Printf ("[ROHIT DEBUG] connectionType: %v" , connectionType )
425435 if connectionType == "Email" {
426436 notificationAction := EmailNotification {}
437+ actionType = "EmailAction"
427438 notificationAction .ActionType = actionType
428439 notificationAction .ConnectionType = connectionType
429440 notificationAction .Subject = notificationActionDict ["subject" ].(string )
@@ -433,6 +444,7 @@ func getNotifications(d *schema.ResourceData) []MonitorNotification {
433444 n .Notification = notificationAction
434445 } else {
435446 notificationAction := WebhookNotificiation {}
447+ actionType = "NamedConnectionAction"
436448 notificationAction .ActionType = actionType
437449 notificationAction .ConnectionType = connectionType
438450 notificationAction .ConnectionID = notificationActionDict ["connection_id" ].(string )
0 commit comments