Skip to content

[BUG]: 6.11.0 - 422 This organization does not allow private repository forking #3173

@andriess

Description

@andriess

Expected Behavior

Expect the description to be updated, and not fail on altering the forking settings.

The allow_forking setting is not used in the resource config (as was the fix in #3159).

Actual Behavior

Correctly identifies the change:

Terraform will perform the following actions:
  # github_repository.repositories will be updated in-place
  ~ resource "github_repository" "repositories" {
      + description                             = "test"
        id                                      = "andries-playground2"
        name                                    = "andries-playground2"
        # (40 unchanged attributes hidden)
        # (1 unchanged block hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

But apply fails with 422 This organization does not allow private repository forking []

<--- snip --->

Initializing provider plugins...
- Finding hashicorp/vault versions matching "~> 5.7.0"...
- Finding integrations/github versions matching "~> 6.11.0"...
- Installing integrations/github v6.11.0...
- Installed integrations/github v6.11.0 (signed by a HashiCorp partner, key ID 38027F80D7FD5FB2)
- Installing hashicorp/vault v5.7.0...
- Installed hashicorp/vault v5.7.0 (signed by HashiCorp)

<--- snip --->

github_repository.repositories: Modifying... [id=andries-playground2]
Error: PATCH https://api.github.com/repos/ORG/andries-playground2: 422 This organization does not allow private repository forking []
  with github_repository.repositories,
  on main.tf line 1, in resource "github_repository" "repositories":
   1: resource "github_repository" "repositories" {
error occurred:

* Failed to execute "terraform apply -auto-approve -no-color" in /home/runner/_work/github-tf/github-tf/live/repositories/andries-playground2/.terragrunt-cache/piEiUGoF_K7yxAT9AB-JDNUX67U/lj5I5nBRe8jKltySjc3PLMqv_nY/repository

  Error: PATCH https://api.github.com/repos/ORG/andries-playground2: 422 This organization does not allow private repository forking []

    with github_repository.repositories,
    on main.tf line 1, in resource "github_repository" "repositories":
     1: resource "github_repository" "repositories" {


  exit status 1

Terraform Version

terraform v1.13.5
on linux_amd64
provider registry.

Affected Resource(s)

  • github_repository

Terraform Configuration Files

resource "github_repository" "repositories" {
  name                        = var.name
  description                 = var.description
  topics                      = var.topics
  allow_auto_merge            = var.allow_auto_merge
  allow_merge_commit          = var.allow_merge_commit
  allow_rebase_merge          = var.allow_rebase_merge
  allow_squash_merge          = var.allow_squash_merge
  allow_update_branch         = var.allow_update_branch
  has_issues                  = var.has_issues
  has_projects                = var.has_projects
  has_wiki                    = var.has_wiki
  vulnerability_alerts        = var.vulnerability_alerts
  delete_branch_on_merge      = var.delete_branch_on_merge
  is_template                 = var.is_template
  homepage_url                = var.homepage_url
  squash_merge_commit_message = var.squash_merge_commit_message
  squash_merge_commit_title   = var.squash_merge_commit_title
  merge_commit_message        = var.merge_commit_message
  merge_commit_title          = var.merge_commit_title
  visibility                  = "private"
  auto_init                   = false
  has_discussions             = false
  web_commit_signoff_required = false
}

Steps to Reproduce

No response

Debug Output

Panic Output

{
      "mode": "managed",
      "type": "github_repository",
      "name": "repositories",
      "provider": "provider[\"registry.terraform.io/integrations/github\"]",
      "instances": [
        {
          "schema_version": 1,
          "attributes": {
            "allow_auto_merge": false,
            "allow_forking": false,
            "allow_merge_commit": true,
            "allow_rebase_merge": true,
            "allow_squash_merge": true,
            "allow_update_branch": true,
            "archive_on_destroy": null,
            "archived": false,
            "auto_init": false,
            "default_branch": "main",
            "delete_branch_on_merge": true,
            "description": "",
            "etag": "there_was_an_etag_here",
            "fork": "false",
            "full_name": "ORG/andries-playground2",
            "git_clone_url": "git://github.com/ORG/andries-playground2.git",
            "gitignore_template": null,
            "has_discussions": false,
            "has_downloads": false,
            "has_issues": true,
            "has_projects": true,
            "has_wiki": true,
            "homepage_url": "",
            "html_url": "https://github.com/ORG/andries-playground2",
            "http_clone_url": "https://github.com/ORG/andries-playground2.git",
            "id": "andries-playground2",
            "ignore_vulnerability_alerts_during_read": false,
            "is_template": false,
            "license_template": null,
            "merge_commit_message": "PR_TITLE",
            "merge_commit_title": "MERGE_MESSAGE",
            "name": "andries-playground2",
            "node_id": "there_was_some_node_id_here",
            "pages": [],
            "primary_language": "",
            "private": true,
            "repo_id": "there_was_some_repo_id_here",
            "security_and_analysis": [
              {
                "advanced_security": [
                  {
                    "status": "disabled"
                  }
                ],
                "code_security": [],
                "secret_scanning": [
                  {
                    "status": "disabled"
                  }
                ],
                "secret_scanning_ai_detection": [],
                "secret_scanning_non_provider_patterns": [],
                "secret_scanning_push_protection": [
                  {
                    "status": "disabled"
                  }
                ]
              }
            ],
            "source_owner": "",
            "source_repo": "",
            "squash_merge_commit_message": "COMMIT_MESSAGES",
            "squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
            "ssh_clone_url": "git@github.com:ORG/andries-playground2.git",
            "svn_url": "https://github.com/ORG/andries-playground2",
            "template": [],
            "topics": [],
            "visibility": "private",
            "vulnerability_alerts": true,
            "web_commit_signoff_required": false
          },
          "sensitive_attributes": [],
          "identity_schema_version": 0,
          "private": "there_was_something_private_here"
        }
      ]
    },

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions