Skip to content

fix: make repository argument required #2603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions github/resource_github_repository_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"net/http"
"regexp"
"strconv"

"github.com/google/go-github/v66/github"
Expand Down Expand Up @@ -38,9 +39,10 @@ func resourceGithubRepositoryRuleset() *schema.Resource {
Description: "Possible values are `branch` and `tag`.",
},
"repository": {
Type: schema.TypeString,
Optional: true,
Description: "Name of the repository to apply rulset to.",
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: toDiagFunc(validation.StringMatch(regexp.MustCompile(`^[-a-zA-Z0-9_.]{1,100}$`), "must include only alphanumeric characters, underscores or hyphens and consist of 100 characters or less"), "name"),
Description: "Name of the repository to apply rulset to.",
},
"enforcement": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/repository_ruleset.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ resource "github_repository_ruleset" "example" {

* `conditions` - (Optional) (Block List, Max: 1) Parameters for a repository ruleset ref name condition. (see [below for nested schema](#conditions))

* `repository` - (Optional) (String) Name of the repository to apply rulset to.
* `repository` - (Required) (String) Name of the repository to apply rulset to.

#### Rules ####

Expand Down
Loading