@@ -46,11 +46,16 @@ func resourceSysdigMonitorTeam() *schema.Resource {
4646 Optional : true ,
4747 },
4848 "scope_by" : {
49+ Type : schema .TypeString ,
50+ Optional : true ,
51+ Default : "host" ,
52+ ValidateFunc : validation .StringInSlice ([]string {"host" , "container" }, false ),
53+ },
54+ "filter" : {
4955 Type : schema .TypeString ,
5056 Optional : true ,
51- Default : "host" ,
5257 },
53- "filter " : {
58+ "prometheus_remote_write_metrics_filter " : {
5459 Type : schema .TypeString ,
5560 Optional : true ,
5661 },
@@ -77,6 +82,11 @@ func resourceSysdigMonitorTeam() *schema.Resource {
7782 Optional : true ,
7883 Default : false ,
7984 },
85+ "can_use_agent_cli" : {
86+ Type : schema .TypeBool ,
87+ Optional : true ,
88+ Default : true ,
89+ },
8090 "user_roles" : {
8191 Type : schema .TypeSet ,
8292 Optional : true ,
@@ -102,7 +112,7 @@ func resourceSysdigMonitorTeam() *schema.Resource {
102112 "type" : {
103113 Type : schema .TypeString ,
104114 Required : true ,
105- ValidateFunc : validation .StringInSlice ([]string {"Explore" , "Dashboards" , "Events" , "Alerts" , "Settings" }, false ),
115+ ValidateFunc : validation .StringInSlice ([]string {"Explore" , "Dashboards" , "Events" , "Alerts" , "Settings" , "DashboardTemplates" , "Advisor" }, false ),
106116 },
107117
108118 "selection" : {
@@ -187,12 +197,21 @@ func resourceSysdigMonitorTeamRead(ctx context.Context, d *schema.ResourceData,
187197 _ = d .Set ("filter" , t .Filter )
188198 _ = d .Set ("can_use_sysdig_capture" , t .CanUseSysdigCapture )
189199 _ = d .Set ("can_see_infrastructure_events" , t .CanUseCustomEvents )
200+ _ = d .Set ("can_use_agent_cli" , t .CanUseAgentCli )
190201 _ = d .Set ("can_use_aws_data" , t .CanUseAwsMetrics )
191202 _ = d .Set ("default_team" , t .DefaultTeam )
192203 _ = d .Set ("user_roles" , userMonitorRolesToSet (t .UserRoles ))
193204 _ = d .Set ("entrypoint" , entrypointToSet (t .EntryPoint ))
194205
195- resourceSysdigTeamReadIBM (d , & t )
206+ var ibmPlatformMetrics * string
207+ var prometheusRemoteWrite * string
208+ if t .NamespaceFilters != nil {
209+ ibmPlatformMetrics = t .NamespaceFilters .IBMPlatformMetrics
210+ prometheusRemoteWrite = t .NamespaceFilters .PrometheusRemoteWrite
211+ }
212+ _ = d .Set ("enable_ibm_platform_metrics" , t .CanUseBeaconMetrics )
213+ _ = d .Set ("ibm_platform_metrics" , ibmPlatformMetrics )
214+ _ = d .Set ("prometheus_remote_write_metrics_filter" , prometheusRemoteWrite )
196215
197216 return nil
198217}
@@ -217,8 +236,12 @@ func entrypointToSet(entrypoint *v2.EntryPoint) (res []map[string]interface{}) {
217236 return
218237 }
219238
239+ module := entrypoint .Module
240+ if module == "Overview" {
241+ module = "Advisor"
242+ }
220243 entrypointMap := map [string ]interface {}{
221- "type" : entrypoint . Module ,
244+ "type" : module ,
222245 "selection" : entrypoint .Selection ,
223246 }
224247 return append (res , entrypointMap )
@@ -264,8 +287,8 @@ func resourceSysdigMonitorTeamDelete(ctx context.Context, d *schema.ResourceData
264287func teamFromResourceData (d * schema.ResourceData , clientType ClientType ) v2.Team {
265288 canUseSysdigCapture := d .Get ("can_use_sysdig_capture" ).(bool )
266289 canUseCustomEvents := d .Get ("can_see_infrastructure_events" ).(bool )
290+ canUseAgentCli := d .Get ("can_use_agent_cli" ).(bool )
267291 canUseAwsMetrics := d .Get ("can_use_aws_data" ).(bool )
268- canUseBeaconMetrics := false
269292 t := v2.Team {
270293 Theme : d .Get ("theme" ).(string ),
271294 Name : d .Get ("name" ).(string ),
@@ -275,7 +298,7 @@ func teamFromResourceData(d *schema.ResourceData, clientType ClientType) v2.Team
275298 CanUseSysdigCapture : & canUseSysdigCapture ,
276299 CanUseCustomEvents : & canUseCustomEvents ,
277300 CanUseAwsMetrics : & canUseAwsMetrics ,
278- CanUseBeaconMetrics : & canUseBeaconMetrics ,
301+ CanUseAgentCli : & canUseAgentCli ,
279302 DefaultTeam : d .Get ("default_team" ).(bool ),
280303 }
281304
@@ -291,11 +314,31 @@ func teamFromResourceData(d *schema.ResourceData, clientType ClientType) v2.Team
291314
292315 t .EntryPoint = & v2.EntryPoint {}
293316 t .EntryPoint .Module = d .Get ("entrypoint.0.type" ).(string )
317+ if t .EntryPoint .Module == "Advisor" {
318+ t .EntryPoint .Module = "Overview"
319+ }
294320 if val , ok := d .GetOk ("entrypoint.0.selection" ); ok {
295321 t .EntryPoint .Selection = val .(string )
296322 }
297323
298- teamFromResourceDataIBM (d , & t )
324+ canUseBeaconMetrics := d .Get ("enable_ibm_platform_metrics" ).(bool )
325+ t .CanUseBeaconMetrics = & canUseBeaconMetrics
326+
327+ if v , ok := d .GetOk ("ibm_platform_metrics" ); ok {
328+ metrics := v .(string )
329+ if t .NamespaceFilters == nil {
330+ t .NamespaceFilters = & v2.NamespaceFilters {}
331+ }
332+ t .NamespaceFilters .IBMPlatformMetrics = & metrics
333+ }
334+
335+ if v , ok := d .GetOk ("prometheus_remote_write_metrics_filter" ); ok {
336+ metrics := v .(string )
337+ if t .NamespaceFilters == nil {
338+ t .NamespaceFilters = & v2.NamespaceFilters {}
339+ }
340+ t .NamespaceFilters .PrometheusRemoteWrite = & metrics
341+ }
299342
300343 return t
301344}
0 commit comments