You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: github_organization_settings resource fails with HTTP 422 #2305
Had this issue as well when attempting to provide a parameter to an organization when that parameter was being enforced by the parent Enterprise. Removing the offending parameter resolved the issue.
(I could not specify the parameter at all - aligning the parameter with the Enterprise requirement returned the same response. Had to comment out the parameter entirely. In my case, the parameter was members_can_fork_private_repositories.)
The API response was much more enlightening:
{
"message": "Validation Failed",
"errors": "Forking policy has been set by enterprise administrators.",
"documentation_url": "https://docs.github.com/rest/orgs/orgs#update-an-organization",
"status": "422"
}
It would be great if the Terraform Provider passed that error message through!
Had this issue as well when attempting to provide a parameter to an organization when that parameter was being enforced by the parent Enterprise. Removing the offending parameter resolved the issue.
That's my problem: how do you find that @stuartpurgavie? The payload is not in the provider log, not even at the most detailed level.
I considered using Fiddler or similar interceptor, but it is a practical impossibility with the our security configuration, and I cannot test EMU from a non-corporate machine.
It would also be great if we could see what was being sent in the body of the request.
It took me a long time to identify how the provider worked so that I could set up a PATCH request that matched what was being set (I checked the terraform json plan for this information), which has a clear as day error message that would have saved me a bunch of time:
{
"message": "Validation Failed",
"errors": "Forking policy has been set by enterprise administrators.",
"documentation_url": "https://docs.github.com/rest/orgs/orgs#update-an-organization",
"status": "422"
}
It feels odd that a PATCH request contains all of the defined parameters, as an aside. The whole point of a PATCH is to provide the data that needs to change isn't it?
If you start with the Enterprise-level policy set to "No Policy" and only have a forking policy defined at the Organization level, then later setting a forking policy at the Enterprise level the resource will fail to be patched, and the provider will error out with a quite hard to understand error message.
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# github_organization_settings.this will be updated in-place~ resource "github_organization_settings""this" {
~ members_can_create_pages = false ->true~ members_can_create_public_pages = false ->true
}
╷
│ Error: PATCH https://api.github.com/orgs/ors-dungeons-dragons: 422 []
│
│ with github_organization_settings.this,
│ on main.tf line 1, in resource "github_organization_settings""this":
│ 1: resource "github_organization_settings""this" {
│
╵
According to my enterprise level for Pages creation settings, Private is disabled. This means that members will not be able to create private sites.
Activity
giuliov-unum commentedon Jul 23, 2024
I tried the same code on a personal account and it works fine, so it seems related to EMU.
stuartpurgavie commentedon Sep 17, 2024
Had this issue as well when attempting to provide a parameter to an organization when that parameter was being enforced by the parent Enterprise. Removing the offending parameter resolved the issue.
(I could not specify the parameter at all - aligning the parameter with the Enterprise requirement returned the same response. Had to comment out the parameter entirely. In my case, the parameter was
members_can_fork_private_repositories.)The API response was much more enlightening:
{ "message": "Validation Failed", "errors": "Forking policy has been set by enterprise administrators.", "documentation_url": "https://docs.github.com/rest/orgs/orgs#update-an-organization", "status": "422" }It would be great if the Terraform Provider passed that error message through!
giuliov-unum commentedon Sep 20, 2024
That's my problem: how do you find that @stuartpurgavie? The payload is not in the provider log, not even at the most detailed level.
I considered using Fiddler or similar interceptor, but it is a practical impossibility with the our security configuration, and I cannot test EMU from a non-corporate machine.
testworksau commentedon Mar 28, 2025
I just wasted half a day of my life on this too; it is very frustrating that the only error I received was:
It would also be great if we could see what was being sent in the body of the request.
It took me a long time to identify how the provider worked so that I could set up a PATCH request that matched what was being set (I checked the terraform json plan for this information), which has a clear as day error message that would have saved me a bunch of time:
It feels odd that a
PATCHrequest contains all of the defined parameters, as an aside. The whole point of aPATCHis to provide the data that needs to change isn't it?vegardx commentedon Apr 14, 2025
If you start with the Enterprise-level policy set to "No Policy" and only have a forking policy defined at the Organization level, then later setting a forking policy at the Enterprise level the resource will fail to be patched, and the provider will error out with a quite hard to understand error message.
venkatesh-thatham commentedon Jul 11, 2025
Need help, I'm also facing same issue when I try to change
members_can_create_pages = true
members_can_create_public_pages = true
According to my enterprise level for Pages creation settings,
Privateis disabled. This means that members will not be able to create private sites.Fix HTTP 422 error in github_organization_settings resource
Fix HTTP 422 error in github_organization_settings resource
Fix HTTP 422 error in github_organization_settings resource
Fix HTTP 422 error in github_organization_settings resource
Fix HTTP 422 error in github_organization_settings resource
Address reviewer comments: replace GetOkExists with hybrid GetOk/Get …