@@ -46,11 +46,16 @@ func resourceSysdigMonitorTeam() *schema.Resource {
46
46
Optional : true ,
47
47
},
48
48
"scope_by" : {
49
+ Type : schema .TypeString ,
50
+ Optional : true ,
51
+ Default : "host" ,
52
+ ValidateFunc : validation .StringInSlice ([]string {"host" , "container" }, false ),
53
+ },
54
+ "filter" : {
49
55
Type : schema .TypeString ,
50
56
Optional : true ,
51
- Default : "host" ,
52
57
},
53
- "filter " : {
58
+ "prometheus_remote_write_metrics_filter " : {
54
59
Type : schema .TypeString ,
55
60
Optional : true ,
56
61
},
@@ -77,6 +82,11 @@ func resourceSysdigMonitorTeam() *schema.Resource {
77
82
Optional : true ,
78
83
Default : false ,
79
84
},
85
+ "can_use_agent_cli" : {
86
+ Type : schema .TypeBool ,
87
+ Optional : true ,
88
+ Default : true ,
89
+ },
80
90
"user_roles" : {
81
91
Type : schema .TypeSet ,
82
92
Optional : true ,
@@ -102,7 +112,7 @@ func resourceSysdigMonitorTeam() *schema.Resource {
102
112
"type" : {
103
113
Type : schema .TypeString ,
104
114
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 ),
106
116
},
107
117
108
118
"selection" : {
@@ -187,12 +197,21 @@ func resourceSysdigMonitorTeamRead(ctx context.Context, d *schema.ResourceData,
187
197
_ = d .Set ("filter" , t .Filter )
188
198
_ = d .Set ("can_use_sysdig_capture" , t .CanUseSysdigCapture )
189
199
_ = d .Set ("can_see_infrastructure_events" , t .CanUseCustomEvents )
200
+ _ = d .Set ("can_use_agent_cli" , t .CanUseAgentCli )
190
201
_ = d .Set ("can_use_aws_data" , t .CanUseAwsMetrics )
191
202
_ = d .Set ("default_team" , t .DefaultTeam )
192
203
_ = d .Set ("user_roles" , userMonitorRolesToSet (t .UserRoles ))
193
204
_ = d .Set ("entrypoint" , entrypointToSet (t .EntryPoint ))
194
205
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 )
196
215
197
216
return nil
198
217
}
@@ -217,8 +236,12 @@ func entrypointToSet(entrypoint *v2.EntryPoint) (res []map[string]interface{}) {
217
236
return
218
237
}
219
238
239
+ module := entrypoint .Module
240
+ if module == "Overview" {
241
+ module = "Advisor"
242
+ }
220
243
entrypointMap := map [string ]interface {}{
221
- "type" : entrypoint . Module ,
244
+ "type" : module ,
222
245
"selection" : entrypoint .Selection ,
223
246
}
224
247
return append (res , entrypointMap )
@@ -264,8 +287,8 @@ func resourceSysdigMonitorTeamDelete(ctx context.Context, d *schema.ResourceData
264
287
func teamFromResourceData (d * schema.ResourceData , clientType ClientType ) v2.Team {
265
288
canUseSysdigCapture := d .Get ("can_use_sysdig_capture" ).(bool )
266
289
canUseCustomEvents := d .Get ("can_see_infrastructure_events" ).(bool )
290
+ canUseAgentCli := d .Get ("can_use_agent_cli" ).(bool )
267
291
canUseAwsMetrics := d .Get ("can_use_aws_data" ).(bool )
268
- canUseBeaconMetrics := false
269
292
t := v2.Team {
270
293
Theme : d .Get ("theme" ).(string ),
271
294
Name : d .Get ("name" ).(string ),
@@ -275,7 +298,7 @@ func teamFromResourceData(d *schema.ResourceData, clientType ClientType) v2.Team
275
298
CanUseSysdigCapture : & canUseSysdigCapture ,
276
299
CanUseCustomEvents : & canUseCustomEvents ,
277
300
CanUseAwsMetrics : & canUseAwsMetrics ,
278
- CanUseBeaconMetrics : & canUseBeaconMetrics ,
301
+ CanUseAgentCli : & canUseAgentCli ,
279
302
DefaultTeam : d .Get ("default_team" ).(bool ),
280
303
}
281
304
@@ -291,11 +314,31 @@ func teamFromResourceData(d *schema.ResourceData, clientType ClientType) v2.Team
291
314
292
315
t .EntryPoint = & v2.EntryPoint {}
293
316
t .EntryPoint .Module = d .Get ("entrypoint.0.type" ).(string )
317
+ if t .EntryPoint .Module == "Advisor" {
318
+ t .EntryPoint .Module = "Overview"
319
+ }
294
320
if val , ok := d .GetOk ("entrypoint.0.selection" ); ok {
295
321
t .EntryPoint .Selection = val .(string )
296
322
}
297
323
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
+ }
299
342
300
343
return t
301
344
}
0 commit comments