@@ -15,6 +15,9 @@ func resourceGitlabGroup() *schema.Resource {
15
15
Read : resourceGitlabGroupRead ,
16
16
Update : resourceGitlabGroupUpdate ,
17
17
Delete : resourceGitlabGroupDelete ,
18
+ Importer : & schema.ResourceImporter {
19
+ State : schema .ImportStatePassthrough ,
20
+ },
18
21
19
22
Schema : map [string ]* schema.Schema {
20
23
"name" : {
@@ -42,8 +45,8 @@ func resourceGitlabGroup() *schema.Resource {
42
45
"visibility_level" : {
43
46
Type : schema .TypeString ,
44
47
Optional : true ,
48
+ Computed : true ,
45
49
ValidateFunc : validation .StringInSlice ([]string {"private" , "internal" , "public" }, true ),
46
- Default : "private" ,
47
50
},
48
51
},
49
52
}
@@ -101,6 +104,7 @@ func resourceGitlabGroupRead(d *schema.ResourceData, meta interface{}) error {
101
104
d .Set ("description" , group .Description )
102
105
d .Set ("lfs_enabled" , group .LFSEnabled )
103
106
d .Set ("request_access_enabled" , group .RequestAccessEnabled )
107
+ d .Set ("visibility_level" , group .Visibility )
104
108
105
109
return nil
106
110
}
@@ -130,8 +134,10 @@ func resourceGitlabGroupUpdate(d *schema.ResourceData, meta interface{}) error {
130
134
options .RequestAccessEnabled = gitlab .Bool (d .Get ("request_access_enabled" ).(bool ))
131
135
}
132
136
133
- if d .HasChange ("visibility_level" ) {
134
- options .Visibility = stringToVisibilityLevel (d .Get ("visibility_level" ).(string ))
137
+ // Always set visibility ; workaround for
138
+ // https://gitlab.com/gitlab-org/gitlab-ce/issues/38459
139
+ if v , ok := d .GetOk ("visibility_level" ); ok {
140
+ options .Visibility = stringToVisibilityLevel (v .(string ))
135
141
}
136
142
137
143
log .Printf ("[DEBUG] update gitlab group %s" , d .Id ())
0 commit comments