Repository navigation
Description
Hi there,
We used EMU, from enterprise level has set fork policy (false).
We want to deploy github_organization_settings to update the organization(which seems can not create but update using update rest api),
but can not work. I think your github_organization_settings api set all input values for rest api including members_can_fork_private_repositories, but when run terraform apply and come out 422 Validation Failed errors because forking policy has been set by enterprise administrators.
If there any possible not to input this members_can_fork_private_repositories in your api calling rest api if no input from users?
Thanks a lot.
Terraform Version
Terraform v1.3.2
on linux_amd64
- provider registry.terraform.io/hashicorp/github v5.3.0
- provider registry.terraform.io/integrations/github v5.3.0
Affected Resource(s)
- github_organization_settings
Terraform Configuration Files
# version.tf
terraform {
required_version = ">= 1.3.0"
required_providers {
github = {
source = "integrations/github"
version = "~> 5.3"
}
}
}
# provider.tf
provider "github" {
}
#org-settings.tf
# Org settings
# Please change variables values if you test
# Even I comment fork policy line, can not work
resource "github_organization_settings" "settings" {
billing_email = "[email protected]"
company = "test"
email = "[email protected]"
twitter_username = ""
location ="mel"
name = "fullservice-test"
description = "test"
has_organization_projects = true
has_repository_projects = true
default_repository_permission = "none"
members_can_create_repositories = true
members_can_create_public_repositories = false
members_can_create_private_repositories = true
members_can_create_internal_repositories = true
members_can_create_pages = true
members_can_create_public_pages = false
members_can_create_private_pages = true
members_can_fork_private_repositories = false
web_commit_signoff_required = false
dependabot_alerts_enabled_for_new_repositories = true
dependabot_security_updates_enabled_for_new_repositories = true
dependency_graph_enabled_for_new_repositories = true
}
Debug Output
2022-10-18T18:15:10.153+1100 [DEBUG] provider.terraform-provider-github_v5.3.0: {
2022-10-18T18:15:10.153+1100 [DEBUG] provider.terraform-provider-github_v5.3.0: "message": "Validation Failed",
2022-10-18T18:15:10.153+1100 [DEBUG] provider.terraform-provider-github_v5.3.0: "errors": "Forking policy has been set by enterprise administrators.",
2022-10-18T18:15:10.153+1100 [DEBUG] provider.terraform-provider-github_v5.3.0: "documentation_url": "https://docs.github.com/rest/reference/orgs#update-an-organization"
2022-10-18T18:15:10.153+1100 [DEBUG] provider.terraform-provider-github_v5.3.0: }
2022-10-18T18:15:10.153+1100 [DEBUG] provider.terraform-provider-github_v5.3.0: -----------------------------------------------------
2022-10-18T18:15:10.169+1100 [TRACE] statemgr.Filesystem: writing snapshot at ./terraform.tfstate
Error: PATCH https://api.github.com/orgs/***-fullservice-test: 422 Validation Failed []
with module.fullservice-test.github_organization_settings.settings,
on modules/gh-org/main.tf line 13, in resource "github_organization_settings" "settings":
13: resource "github_organization_settings" "settings" {
Expected Behavior
Can update organization settings
Actual Behavior
Error: PATCH https://api.github.com/orgs/***-fullservice-test: 422 Validation Failed []
errors": "Forking policy has been set by enterprise administrators.",
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform importimport existing organization manually createdterraform initterraform apply
Important Factoids
My PAT token have full admin permissions, I had tried rest api to update org directly, can update the org if not input members_can_fork_private_repositories, if input it can not work cos enterprise level has controlled this.
Activity
fatenhealy commentedon Oct 19, 2022
Thanks @Yvonne-YAO for raising this issue 👍🏼
cc @kuhlman-labs FYI Thanks in advance 🙏🏼
kuhlman-labs commentedon Oct 19, 2022
@Yvonne-YAO I will be investigating this today.
kfcampbell commentedon Oct 27, 2022
@kuhlman-labs any thoughts? I wouldn't mind pairing on this with you if you'd like a second pair of eyes!
kuhlman-labs commentedon Oct 28, 2022
Yes, that would be great!
kuhlman-labs commentedon Nov 15, 2022
@Yvonne-YAO @fatenhealy I have a PR submitted to fix this issue here:
#1362
Yvonne-YAO commentedon Nov 18, 2022
@kuhlman-labs @kfcampbell @fatenhealy Great! Thanks all :)
fix: avoid 422 when enterprise policy controls org fork setting
fix: avoid 422 when enterprise policy controls org fork setting