@@ -94,7 +94,7 @@ func resourceGitlabProject() *schema.Resource {
94
94
Computed : true ,
95
95
},
96
96
"shared_with_groups" : {
97
- Type : schema .TypeList ,
97
+ Type : schema .TypeSet ,
98
98
Optional : true ,
99
99
Elem : & schema.Resource {
100
100
Schema : map [string ]* schema.Schema {
@@ -170,7 +170,7 @@ func resourceGitlabProjectCreate(d *schema.ResourceData, meta interface{}) error
170
170
}
171
171
172
172
if v , ok := d .GetOk ("shared_with_groups" ); ok {
173
- options := expandSharedWithGroupsOptions (v .([] interface {}) )
173
+ options := expandSharedWithGroupsOptions (v )
174
174
175
175
for _ , option := range options {
176
176
_ , err := client .Projects .ShareProjectWithGroup (project .ID , option )
@@ -298,10 +298,10 @@ func resourceGitlabProjectDelete(d *schema.ResourceData, meta interface{}) error
298
298
return nil
299
299
}
300
300
301
- func expandSharedWithGroupsOptions (d [] interface {}) []* gitlab.ShareWithGroupOptions {
301
+ func expandSharedWithGroupsOptions (v interface {}) []* gitlab.ShareWithGroupOptions {
302
302
shareWithGroupOptionsList := []* gitlab.ShareWithGroupOptions {}
303
303
304
- for _ , config := range d {
304
+ for _ , config := range v .( * schema. Set ). List () {
305
305
data := config .(map [string ]interface {})
306
306
307
307
groupAccess := accessLevelNameToValue [data ["group_access_level" ].(string )]
@@ -368,8 +368,7 @@ func updateSharedWithGroups(d *schema.ResourceData, meta interface{}) error {
368
368
var groupsToShare []* gitlab.ShareWithGroupOptions
369
369
370
370
// Get target groups from the TF config and current groups from Gitlab server
371
- targetGroups := expandSharedWithGroupsOptions (
372
- d .Get ("shared_with_groups" ).([]interface {}))
371
+ targetGroups := expandSharedWithGroupsOptions (d .Get ("shared_with_groups" ))
373
372
project , _ , err := client .Projects .GetProject (d .Id ())
374
373
if err != nil {
375
374
return err
0 commit comments