Skip to content

Commit

Permalink
[Docs] Fix organization ruleset conditions schema validation, update …
Browse files Browse the repository at this point in the history
…docs
  • Loading branch information
nickfloyd authored Sep 21, 2023
2 parents 69d1fcd + 4f041d0 commit 8540ea4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions github/resource_github_organization_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
"actor_id": {
Type: schema.TypeInt,
Required: true,
Description: "The ID of the actor that can bypass a ruleset",
Description: "The ID of the actor that can bypass a ruleset. When `actor_type` is `OrganizationAdmin`, this should be set to `1`.",
},
"actor_type": {
Type: schema.TypeString,
Expand Down Expand Up @@ -83,7 +83,7 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Parameters for a repository ruleset ref name condition.",
Description: "Parameters for an organization ruleset condition. `ref_name` is required alongside one of `repository_name` or `repository_id`.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ref_name": {
Expand Down Expand Up @@ -112,10 +112,11 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
},
},
"repository_name": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"conditions.0.repository_id"},
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ExactlyOneOf: []string{"conditions.0.repository_id"},
AtLeastOneOf: []string{"conditions.0.repository_id"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"include": {
Expand Down Expand Up @@ -144,10 +145,9 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
},
},
"repository_id": {
Type: schema.TypeList,
Optional: true,
ConflictsWith: []string{"conditions.0.repository_name"},
Description: "The repository IDs that the ruleset applies to. One of these IDs must match for the condition to pass.",
Type: schema.TypeList,
Optional: true,
Description: "The repository IDs that the ruleset applies to. One of these IDs must match for the condition to pass.",
Elem: &schema.Schema{
Type: schema.TypeInt,
},
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_repository_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func resourceGithubRepositoryRuleset() *schema.Resource {
"actor_id": {
Type: schema.TypeInt,
Required: true,
Description: "The ID of the actor that can bypass a ruleset",
Description: "The ID of the actor that can bypass a ruleset. When `actor_type` is `OrganizationAdmin`, this should be set to `1`.",
},
"actor_type": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/organization_ruleset.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resource "github_organization_ruleset" "example" {

* `bypass_actors` - (Optional) (Block List) The actors that can bypass the rules in this ruleset. (see [below for nested schema](#bypass_actors))

* `conditions` - (Optional) (Block List, Max: 1) Parameters for an organization ruleset ref name condition. (see [below for nested schema](#conditions))
* `conditions` - (Optional) (Block List, Max: 1) Parameters for an organization ruleset condition. `ref_name` is required alongside one of `repository_name` or `repository_id`. (see [below for nested schema](#conditions))

#### Rules ####

Expand Down Expand Up @@ -178,7 +178,7 @@ The `rules` block supports the following:

#### bypass_actors ####

* `actor_id` - (Required) (Number) The ID of the actor that can bypass a ruleset
* `actor_id` - (Required) (Number) The ID of the actor that can bypass a ruleset. When `actor_type` is `OrganizationAdmin`, this should be set to `1`.

* `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`.

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 @@ -195,7 +195,7 @@ The `rules` block supports the following:

#### bypass_actors ####

* `actor_id` - (Required) (Number) The ID of the actor that can bypass a ruleset
* `actor_id` - (Required) (Number) The ID of the actor that can bypass a ruleset. When `actor_type` is `OrganizationAdmin`, this should be set to `1`.

* `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`.

Expand Down

0 comments on commit 8540ea4

Please sign in to comment.