@@ -41,7 +41,7 @@ func TestAccGitlabGroup_basic(t *testing.T) {
41
41
},
42
42
// Update the group to change the description
43
43
{
44
- Config : testAccGitlabGroupUpdateConfig (rInt ),
44
+ Config : testAccGitlabGroupUpdateConfig (rInt , 1 ),
45
45
Check : resource .ComposeTestCheckFunc (
46
46
testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
47
47
testAccCheckGitlabGroupAttributes (& group , & testAccGitlabGroupExpectedAttributes {
@@ -63,6 +63,30 @@ func TestAccGitlabGroup_basic(t *testing.T) {
63
63
}),
64
64
),
65
65
},
66
+ // Update the group to use zero-value `default_branch_protection`
67
+ {
68
+ Config : testAccGitlabGroupUpdateConfig (rInt , 0 ),
69
+ Check : resource .ComposeTestCheckFunc (
70
+ testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
71
+ testAccCheckGitlabGroupAttributes (& group , & testAccGitlabGroupExpectedAttributes {
72
+ Name : fmt .Sprintf ("bar-name-%d" , rInt ),
73
+ Path : fmt .Sprintf ("bar-path-%d" , rInt ),
74
+ Description : "Terraform acceptance tests! Updated description" ,
75
+ LFSEnabled : false ,
76
+ Visibility : "public" , // default value
77
+ RequestAccessEnabled : true ,
78
+ ProjectCreationLevel : "developer" ,
79
+ SubGroupCreationLevel : "maintainer" ,
80
+ RequireTwoFactorAuth : true ,
81
+ TwoFactorGracePeriod : 56 ,
82
+ AutoDevopsEnabled : true ,
83
+ EmailsDisabled : true ,
84
+ MentionsDisabled : true ,
85
+ ShareWithGroupLock : true ,
86
+ DefaultBranchProtection : 0 ,
87
+ }),
88
+ ),
89
+ },
66
90
// Update the group to put the name and description back
67
91
{
68
92
Config : testAccGitlabGroupConfig (rInt ),
@@ -398,7 +422,7 @@ resource "gitlab_group" "foo" {
398
422
` , rInt , rInt )
399
423
}
400
424
401
- func testAccGitlabGroupUpdateConfig (rInt int ) string {
425
+ func testAccGitlabGroupUpdateConfig (rInt int , defaultBranchProtection int ) string {
402
426
return fmt .Sprintf (`
403
427
resource "gitlab_group" "foo" {
404
428
name = "bar-name-%d"
@@ -414,13 +438,13 @@ resource "gitlab_group" "foo" {
414
438
emails_disabled = true
415
439
mentions_disabled = true
416
440
share_with_group_lock = true
417
- default_branch_protection = 1
441
+ default_branch_protection = %d
418
442
419
443
# So that acceptance tests can be run in a gitlab organization
420
444
# with no billing
421
445
visibility_level = "public"
422
446
}
423
- ` , rInt , rInt )
447
+ ` , rInt , rInt , defaultBranchProtection )
424
448
}
425
449
426
450
func testAccGitlabNestedGroupConfig (rInt int ) string {
0 commit comments