Skip to content

Commit 3326ec6

Browse files
committed
Set allowed_merge_methods to Optional
Signed-off-by: Timo Sand <[email protected]>
1 parent f8d6f69 commit 3326ec6

4 files changed

Lines changed: 8 additions & 4 deletions

github/resource_github_organization_ruleset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
200200
Schema: map[string]*schema.Schema{
201201
"allowed_merge_methods": {
202202
Type: schema.TypeList,
203-
Required: true,
203+
Optional: true,
204204
MinItems: 1,
205205
Description: "Array of allowed merge methods. Allowed values include `merge`, `squash`, and `rebase`. At least one option must be enabled.",
206206
Elem: &schema.Schema{

github/resource_github_organization_ruleset_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ resource "github_organization_ruleset" "test" {
9595
required_signatures = false
9696
9797
pull_request {
98-
allowed_merge_methods = ["merge", "rebase", "squash"]
9998
required_approving_review_count = 2
10099
required_review_thread_resolution = true
101100
require_code_owner_review = true

github/resource_github_repository_ruleset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func resourceGithubRepositoryRuleset() *schema.Resource {
191191
Schema: map[string]*schema.Schema{
192192
"allowed_merge_methods": {
193193
Type: schema.TypeList,
194-
Required: true,
194+
Optional: true,
195195
MinItems: 1,
196196
Description: "Array of allowed merge methods. Allowed values include `merge`, `squash`, and `rebase`. At least one option must be enabled.",
197197
Elem: &schema.Schema{

github/resource_github_repository_ruleset_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import (
1313
)
1414

1515
func TestAccGithubRepositoryRuleset(t *testing.T) {
16+
baseVisibility := "public"
17+
if testAccConf.authMode == enterprise {
18+
baseVisibility = "private" // Enable tests to run on GHEC EMU
19+
}
1620
t.Run("create_branch_ruleset", func(t *testing.T) {
1721
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
1822
repoName := fmt.Sprintf("%srepo-ruleset-%s", testResourcePrefix, randomID)
@@ -23,6 +27,7 @@ resource "github_repository" "test" {
2327
auto_init = true
2428
default_branch = "main"
2529
vulnerability_alerts = true
30+
visibility = "%s"
2631
}
2732
2833
resource "github_repository_environment" "example" {
@@ -112,7 +117,7 @@ resource "github_repository_ruleset" "test" {
112117
}
113118
}
114119
}
115-
`, repoName)
120+
`, repoName, baseVisibility)
116121

117122
resource.Test(t, resource.TestCase{
118123
PreCheck: func() { skipUnauthenticated(t) },

0 commit comments

Comments
 (0)