@@ -63,9 +63,9 @@ func dataSourceSumologicRoleV2() *schema.Resource {
6363 Computed : true ,
6464 },
6565 "capabilities" : {
66- Type : schema .TypeList ,
66+ Type : schema .TypeSet ,
6767 Computed : true ,
68- Description : "List of [capabilities](https://help.sumologic.com/docs/manage/users-roles/roles/role-capabilities/) associated with this role" ,
68+ Description : "Set of [capabilities](https://help.sumologic.com/docs/manage/users-roles/roles/role-capabilities/) associated with this role" ,
6969 Elem : & schema.Schema {
7070 Type : schema .TypeString ,
7171 },
@@ -110,9 +110,11 @@ func dataSourceSumologicRoleV2Read(d *schema.ResourceData, meta interface{}) err
110110 d .Set ("description" , roleV2 .Description )
111111 d .Set ("security_data_filter" , roleV2 .SecurityDataFilter )
112112 d .Set ("log_analytics_filter" , roleV2 .LogAnalyticsFilter )
113- if err := d .Set ("capabilities" , roleV2 .Capabilities ); err != nil {
113+
114+ if err := d .Set ("capabilities" , schema .NewSet (schema .HashString , convertStringsToInterfaces (roleV2 .Capabilities ))); err != nil {
114115 return fmt .Errorf ("error setting capabilities for datasource %s: %s" , d .Id (), err )
115116 }
117+
116118 if err := d .Set ("selected_views" , flattenSelectedViews (roleV2 .SelectedViews )); err != nil {
117119 return fmt .Errorf ("error setting selected views for datasource %s: %s" , d .Id (), err )
118120 }
@@ -142,6 +144,14 @@ func (s *Client) GetRoleNameV2(name string) (*RoleV2, error) {
142144 return & response .RolesV2 [0 ], nil
143145}
144146
147+ func convertStringsToInterfaces (strs []string ) []interface {} {
148+ result := make ([]interface {}, len (strs ))
149+ for i , s := range strs {
150+ result [i ] = s
151+ }
152+ return result
153+ }
154+
145155type RoleResponseV2 struct {
146156 RolesV2 []RoleV2 `json:"data"`
147157}
0 commit comments