@@ -147,6 +147,22 @@ func getPanelSchema() map[string]*schema.Schema {
147147 Schema : getTextPanelSchema (),
148148 },
149149 },
150+ "traces_list_panel" : {
151+ Type : schema .TypeList ,
152+ Optional : true ,
153+ MaxItems : 1 ,
154+ Elem : & schema.Resource {
155+ Schema : getTracesListPanelSchema (),
156+ },
157+ },
158+ "service_map_panel" : {
159+ Type : schema .TypeList ,
160+ Optional : true ,
161+ MaxItems : 1 ,
162+ Elem : & schema.Resource {
163+ Schema : getServiceMapPanelSchema (),
164+ },
165+ },
150166 }
151167}
152168
@@ -259,6 +275,64 @@ func getSumoSearchPanelSchema() map[string]*schema.Schema {
259275 return panelSchema
260276}
261277
278+ func getTracesListPanelSchema () map [string ]* schema.Schema {
279+ panelSchema := getPanelBaseSchema ()
280+
281+ traceListPanelSchema := map [string ]* schema.Schema {
282+ "queries" : {
283+ Type : schema .TypeList ,
284+ Optional : true ,
285+ Elem : & schema.Resource {
286+ Schema : getSumoSearchPanelQuerySchema (),
287+ },
288+ MaxItems : 6 ,
289+ },
290+ "time_range" : {
291+ Type : schema .TypeList ,
292+ Optional : true ,
293+ MaxItems : 1 ,
294+ Elem : & schema.Resource {
295+ Schema : GetTimeRangeSchema (),
296+ },
297+ },
298+ }
299+
300+ for k , v := range traceListPanelSchema {
301+ panelSchema [k ] = v
302+ }
303+
304+ return panelSchema
305+ }
306+
307+ func getServiceMapPanelSchema () map [string ]* schema.Schema {
308+ panelSchema := getPanelBaseSchema ()
309+
310+ serviceMapPanelSchema := map [string ]* schema.Schema {
311+ "application" : {
312+ Type : schema .TypeString ,
313+ Optional : true ,
314+ },
315+ "service" : {
316+ Type : schema .TypeString ,
317+ Optional : true ,
318+ },
319+ "show_remote_services" : {
320+ Type : schema .TypeBool ,
321+ Optional : true ,
322+ },
323+ "environment" : {
324+ Type : schema .TypeString ,
325+ Optional : true ,
326+ },
327+ }
328+
329+ for k , v := range serviceMapPanelSchema {
330+ panelSchema [k ] = v
331+ }
332+
333+ return panelSchema
334+ }
335+
262336func getSumoSearchPanelQuerySchema () map [string ]* schema.Schema {
263337 return map [string ]* schema.Schema {
264338 "query_string" : {
@@ -599,6 +673,14 @@ func getPanel(tfPanel map[string]interface{}) interface{} {
599673 if tfSearchPanel , ok := val [0 ].(map [string ]interface {}); ok {
600674 return getSumoSearchPanel (tfSearchPanel )
601675 }
676+ } else if val := tfPanel ["traces_list_panel" ].([]interface {}); len (val ) == 1 {
677+ if tfTracesListPanel , ok := val [0 ].(map [string ]interface {}); ok {
678+ return getTracesListPanel (tfTracesListPanel )
679+ }
680+ } else if val := tfPanel ["service_map_panel" ].([]interface {}); len (val ) == 1 {
681+ if tfServiceMapPanel , ok := val [0 ].(map [string ]interface {}); ok {
682+ return getServiceMapPanel (tfServiceMapPanel )
683+ }
602684 }
603685 return nil
604686}
@@ -674,6 +756,64 @@ func getSumoSearchPanel(tfSearchPanel map[string]interface{}) interface{} {
674756 return searchPanel
675757}
676758
759+ func getTracesListPanel (tfPanel map [string ]interface {}) interface {} {
760+ var panel TracesListPanel
761+ panel .PanelType = "TracesListPanel"
762+
763+ panel .Key = tfPanel ["key" ].(string )
764+ if title , ok := tfPanel ["title" ].(string ); ok {
765+ panel .Title = title
766+ }
767+ if visualSettings , ok := tfPanel ["visual_settings" ].(string ); ok {
768+ panel .VisualSettings = visualSettings
769+ }
770+ if consistentVisualSettings , ok := tfPanel ["keep_visual_settings_consistent_with_parent" ].(bool ); ok {
771+ panel .KeepVisualSettingsConsistentWithParent = consistentVisualSettings
772+ }
773+ tfQueries := tfPanel ["query" ].([]interface {})
774+ var queries []SearchPanelQuery
775+ for _ , tfQuery := range tfQueries {
776+ query := getSearchPanelQuery (tfQuery .(map [string ]interface {}))
777+ queries = append (queries , query )
778+ }
779+ panel .Queries = queries
780+ if timeRangeData , ok := tfPanel ["time_range" ].([]interface {}); ok && len (timeRangeData ) > 0 {
781+ panel .TimeRange = GetTimeRange (timeRangeData [0 ].(map [string ]interface {}))
782+ }
783+
784+ return panel
785+ }
786+
787+ func getServiceMapPanel (tfPanel map [string ]interface {}) interface {} {
788+ var panel ServiceMapPanel
789+ panel .PanelType = "ServiceMapPanel"
790+
791+ panel .Key = tfPanel ["key" ].(string )
792+ if title , ok := tfPanel ["title" ].(string ); ok {
793+ panel .Title = title
794+ }
795+ if visualSettings , ok := tfPanel ["visual_settings" ].(string ); ok {
796+ panel .VisualSettings = visualSettings
797+ }
798+ if consistentVisualSettings , ok := tfPanel ["keep_visual_settings_consistent_with_parent" ].(bool ); ok {
799+ panel .KeepVisualSettingsConsistentWithParent = consistentVisualSettings
800+ }
801+ if application , ok := tfPanel ["application" ].(string ); ok {
802+ panel .Application = application
803+ }
804+ if service , ok := tfPanel ["service" ].(string ); ok {
805+ panel .Service = service
806+ }
807+ if showRemoteServices , ok := tfPanel ["show_remote_services" ].(bool ); ok {
808+ panel .ShowRemoteServices = showRemoteServices
809+ }
810+ if environment , ok := tfPanel ["environment" ].(string ); ok {
811+ panel .Environment = environment
812+ }
813+
814+ return panel
815+ }
816+
677817func getSearchPanelQuery (tfQuery map [string ]interface {}) SearchPanelQuery {
678818 var query SearchPanelQuery
679819
@@ -1004,6 +1144,10 @@ func getTerraformPanels(panels []interface{}) []map[string]interface{} {
10041144 tfPanel ["text_panel" ] = getTerraformTextPanel (panel )
10051145 } else if panel ["panelType" ] == "SumoSearchPanel" {
10061146 tfPanel ["sumo_search_panel" ] = getTerraformSearchPanel (panel )
1147+ } else if panel ["panelType" ] == "TracesListPanel" {
1148+ tfPanel ["traces_list_panel" ] = getTerraformTracesListPanel (panel )
1149+ } else if panel ["panelType" ] == "ServiceMapPanel" {
1150+ tfPanel ["service_map_panel" ] = getTerraformServiceMapPanel (panel )
10071151 }
10081152
10091153 tfPanels [i ] = tfPanel
@@ -1060,6 +1204,60 @@ func getTerraformSearchPanel(searchPanel map[string]interface{}) TerraformObject
10601204 return tfSearchPanel
10611205}
10621206
1207+ func getTerraformTracesListPanel (panel map [string ]interface {}) TerraformObject {
1208+ tfTracesListPanel := MakeTerraformObject ()
1209+
1210+ tfTracesListPanel [0 ]["key" ] = panel ["key" ]
1211+
1212+ if title , ok := panel ["title" ].(string ); ok {
1213+ tfTracesListPanel [0 ]["title" ] = title
1214+ }
1215+ if visualSettings , ok := panel ["visual_settings" ].(string ); ok {
1216+ tfTracesListPanel [0 ]["visual_settings" ] = visualSettings
1217+ }
1218+ if keepVisualSettingsConsistentWithParent , ok := panel ["keepVisualSettingsConsistentWithParent" ]; ok {
1219+ tfTracesListPanel [0 ]["keep_visual_settings_consistent_with_parent" ] = keepVisualSettingsConsistentWithParent
1220+ }
1221+
1222+ tfTracesListPanel [0 ]["queries" ] = getTerraformSearchPanelQuery (panel ["queries" ].([]interface {}))
1223+
1224+ if timeRange := panel ["timeRange" ]; timeRange != nil {
1225+ tfTracesListPanel [0 ]["time_range" ] = GetTerraformTimeRange (timeRange .(map [string ]interface {}))
1226+ }
1227+
1228+ return tfTracesListPanel
1229+ }
1230+
1231+ func getTerraformServiceMapPanel (panel map [string ]interface {}) TerraformObject {
1232+ tfServiceMapPanel := MakeTerraformObject ()
1233+
1234+ tfServiceMapPanel [0 ]["key" ] = panel ["key" ]
1235+
1236+ if title , ok := panel ["title" ].(string ); ok {
1237+ tfServiceMapPanel [0 ]["title" ] = title
1238+ }
1239+ if visualSettings , ok := panel ["visual_settings" ].(string ); ok {
1240+ tfServiceMapPanel [0 ]["visual_settings" ] = visualSettings
1241+ }
1242+ if keepVisualSettingsConsistentWithParent , ok := panel ["keepVisualSettingsConsistentWithParent" ]; ok {
1243+ tfServiceMapPanel [0 ]["keep_visual_settings_consistent_with_parent" ] = keepVisualSettingsConsistentWithParent
1244+ }
1245+ if application , ok := panel ["application" ].(string ); ok {
1246+ tfServiceMapPanel [0 ]["application" ] = application
1247+ }
1248+ if service , ok := panel ["service" ].(string ); ok {
1249+ tfServiceMapPanel [0 ]["service" ] = service
1250+ }
1251+ if showRemoteServices , ok := panel ["show_remote_services" ].(bool ); ok {
1252+ tfServiceMapPanel [0 ]["show_remote_services" ] = showRemoteServices
1253+ }
1254+ if environment , ok := panel ["environment" ].(string ); ok {
1255+ tfServiceMapPanel [0 ]["environment" ] = environment
1256+ }
1257+
1258+ return tfServiceMapPanel
1259+ }
1260+
10631261func getTerraformSearchPanelQuery (queries []interface {}) []map [string ]interface {} {
10641262 tfPanelQueries := make ([]map [string ]interface {}, len (queries ))
10651263
0 commit comments