@@ -246,6 +246,35 @@ func TestAccGitlabGroup_disappears(t *testing.T) {
246
246
})
247
247
}
248
248
249
+ func TestAccGitlabGroup_PreventForkingOutsideGroup (t * testing.T ) {
250
+ var group gitlab.Group
251
+ rInt := acctest .RandInt ()
252
+
253
+ resource .Test (t , resource.TestCase {
254
+ PreCheck : func () { testAccPreCheck (t ) },
255
+ ProviderFactories : providerFactories ,
256
+ CheckDestroy : testAccCheckGitlabGroupDestroy ,
257
+ Steps : []resource.TestStep {
258
+ {
259
+ SkipFunc : isRunningInCE ,
260
+ Config : testAccGitlabGroupPreventForkingOutsideGroupConfig (rInt ),
261
+ Check : resource .ComposeTestCheckFunc (
262
+ testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
263
+ resource .TestCheckResourceAttr ("gitlab_group.foo" , "prevent_forking_outside_group" , "true" ),
264
+ ),
265
+ },
266
+ {
267
+ SkipFunc : isRunningInCE ,
268
+ Config : testAccGitlabGroupPreventForkingOutsideGroupUpdateConfig (rInt ),
269
+ Check : resource .ComposeTestCheckFunc (
270
+ testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
271
+ resource .TestCheckResourceAttr ("gitlab_group.foo" , "prevent_forking_outside_group" , "false" ),
272
+ ),
273
+ },
274
+ },
275
+ })
276
+ }
277
+
249
278
func testAccCheckGitlabGroupDisappears (group * gitlab.Group ) resource.TestCheckFunc {
250
279
return func (s * terraform.State ) error {
251
280
_ , err := testGitlabClient .Groups .DeleteGroup (group .ID )
@@ -544,3 +573,35 @@ resource "gitlab_group" "nested_foo" {
544
573
}
545
574
` , rInt , rInt , rInt , rInt , rInt , rInt )
546
575
}
576
+
577
+ func testAccGitlabGroupPreventForkingOutsideGroupConfig (rInt int ) string {
578
+ return fmt .Sprintf (`
579
+ resource "gitlab_group" "foo" {
580
+ name = "foo-name-%d"
581
+ path = "foo-path-%d"
582
+ description = "Terraform acceptance tests"
583
+
584
+ # So that acceptance tests can be run in a gitlab organization
585
+ # with no billing
586
+ visibility_level = "public"
587
+
588
+ prevent_forking_outside_group = true
589
+ }
590
+ ` , rInt , rInt )
591
+ }
592
+
593
+ func testAccGitlabGroupPreventForkingOutsideGroupUpdateConfig (rInt int ) string {
594
+ return fmt .Sprintf (`
595
+ resource "gitlab_group" "foo" {
596
+ name = "foo-name-%d"
597
+ path = "foo-path-%d"
598
+ description = "Terraform acceptance tests"
599
+
600
+ # So that acceptance tests can be run in a gitlab organization
601
+ # with no billing
602
+ visibility_level = "public"
603
+
604
+ prevent_forking_outside_group = false
605
+ }
606
+ ` , rInt , rInt )
607
+ }
0 commit comments