Skip to content

Commit b7d4d4f

Browse files
authored
Merge pull request #999 from defreng/main
add "owner" as valid access level for the group_access_token resource
2 parents 59c52b9 + 20953ff commit b7d4d4f

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/resources/group_access_token.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ resource "gitlab_group_variable" "example" {
4646

4747
### Optional
4848

49-
- `access_level` (String) The access level for the group access token. Valid values are: `guest`, `reporter`, `developer`, `maintainer`.
49+
- `access_level` (String) The access level for the group access token. Valid values are: `guest`, `reporter`, `developer`, `maintainer`, `owner`.
5050
- `expires_at` (String) The token expires at midnight UTC on that date. The date must be in the format YYYY-MM-DD. Default is never.
5151
- `id` (String) The ID of this resource.
5252

internal/provider/resource_gitlab_group_access_token.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var validAccessLevels = []string{
2727
"reporter",
2828
"developer",
2929
"maintainer",
30+
"owner",
3031
}
3132

3233
var _ = registerResource("gitlab_group_access_token", func() *schema.Resource {

internal/provider/resource_gitlab_group_access_token_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ func TestAccGitlabGroupAccessToken_basic(t *testing.T) {
4848
}),
4949
),
5050
},
51+
// Update the Group Access Token Access Level to Owner
52+
{
53+
Config: testAccGitlabGroupAccessTokenUpdateAccessLevel(testGroup.ID),
54+
Check: resource.ComposeTestCheckFunc(
55+
testAccCheckGitlabGroupAccessTokenExists("gitlab_group_access_token.this", &gat),
56+
testAccCheckGitlabGroupAccessTokenAttributes(&gat, &testAccGitlabGroupAccessTokenExpectedAttributes{
57+
name: "my new group token",
58+
scopes: map[string]bool{"read_repository": false, "api": true, "write_repository": false, "read_api": false},
59+
expiresAt: "2099-05-01",
60+
accessLevel: gitlab.AccessLevelValue(gitlab.OwnerPermissions),
61+
}),
62+
),
63+
},
5164
// Add a CICD variable with Group Access Token value
5265
{
5366
Config: testAccGitlabGroupAccessTokenUpdateConfigWithCICDvar(testGroup.ID),
@@ -229,6 +242,18 @@ resource "gitlab_group_access_token" "this" {
229242
`, groupId)
230243
}
231244

245+
func testAccGitlabGroupAccessTokenUpdateAccessLevel(groupId int) string {
246+
return fmt.Sprintf(`
247+
resource "gitlab_group_access_token" "this" {
248+
name = "my new group token"
249+
group = %d
250+
expires_at = "2099-05-01"
251+
access_level = "owner"
252+
scopes = ["api"]
253+
}
254+
`, groupId)
255+
}
256+
232257
func testAccGitlabGroupAccessTokenUpdateConfigWithCICDvar(groupId int) string {
233258
return fmt.Sprintf(`
234259
resource "gitlab_group_access_token" "this" {

0 commit comments

Comments
 (0)