Skip to content

Commit 08b4cec

Browse files
andrewesweetclaude
andcommitted
fix: avoid 422 when enterprise policy controls org fork setting
Remove Default: false from members_can_fork_private_repositories schema to prevent the field from being sent to the API when not explicitly set by the user. When an enterprise-level policy locks this setting, sending any value causes a 422 validation error. Without a default, the field is only included in API calls when the user explicitly configures it, matching the behavior of members_can_create_internal_repositories (enterprise-only field). Fixes #2689 Relates to #1333 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7905a12 commit 08b4cec

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

github/resource_github_organization_settings.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ func resourceGithubOrganizationSettings() *schema.Resource {
119119
"members_can_fork_private_repositories": {
120120
Type: schema.TypeBool,
121121
Optional: true,
122-
Default: false,
123-
Description: "Whether or not organization members can fork private repositories.",
122+
Description: "Whether or not organization members can fork private repositories. When an enterprise policy controls this setting, omit this attribute to avoid API validation errors.",
124123
},
125124
"web_commit_signoff_required": {
126125
Type: schema.TypeBool,

website/docs/r/organization_settings.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The following arguments are supported:
6464
* `members_can_create_pages` - (Optional) Whether or not organization members can create new pages. Defaults to `true`.
6565
* `members_can_create_public_pages` - (Optional) Whether or not organization members can create new public pages. Defaults to `true`.
6666
* `members_can_create_private_pages` - (Optional) Whether or not organization members can create new private pages. Defaults to `true`.
67-
* `members_can_fork_private_repositories` - (Optional) Whether or not organization members can fork private repositories. Defaults to `false`.
67+
* `members_can_fork_private_repositories` - (Optional) Whether or not organization members can fork private repositories. When an enterprise policy controls this setting, omit this attribute to avoid API validation errors.
6868
* `web_commit_signoff_required` - (Optional) Whether or not commit signatures are required for commits to the organization. Defaults to `false`.
6969
* `advanced_security_enabled_for_new_repositories` - (Optional) Whether or not advanced security is enabled for new repositories. Defaults to `false`.
7070
* `dependabot_alerts_enabled_for_new_repositories` - (Optional) Whether or not dependabot alerts are enabled for new repositories. Defaults to `false`.

0 commit comments

Comments
 (0)