Skip to content

[BUG]: Delete Repository In another Org after xfer #3270

@match-caseydaniell

Description

@match-caseydaniell

Expected Behavior

We transferred a repository from Org A to a new Org Z (both in our GitHub Enterprise) .

After performing the transfer I removed the Terraform block that created and controlled the repository in the TF code controlling Org A, but left the code in the TF code controlling Org Z.

Actual Behavior

My expectation is that only the state files would get cleaned up, and no actual repo removals would occur as the repository existed in Org Z now.

Terraform Version

required_version = "> 1.12"
required_providers {
github = {
source = "integrations/github"
version = "
> 6.6.0"
}

Affected Resource(s)

  • github_repository

Terraform Configuration Files

module "RepoName" {
  source      = "../modules/org_repository"
  name        = "RepoName"
  description = ""
  topics = [
    "tsql"
  ]
  protected_branches_ruleset = local.default_protected_branches_ruleset.main
  admin-members = [
    local.users.redactedUser1,
    local.users.redactedUser2
  ]
  write-members = distinct(concat(
    local.global-users.write-members,
    [
      local.users.redacted-user3
      local.users.redacted-user4,
      .....
      local.users.recacted-userX,
    ]
  ))
}

Steps to Reproduce

Sequence of events

  1. Created a new github.com// repo via Terraform https://github.com//github-terraform-repository
  2. Manually deleted github.com// repo leaving the terraform state files as they were. This is what controls repos / teams / etc in github.com/
  3. Changed ownership of github.com// from to which transferred the repo over to
  4. I realized the terraform code controlling was breaking as I didn't remove from https://github.com//github-terraform-repository so I removed from the org's terraform and pushed through a change, which I expected to only clean up local Terraform state files for
  5. The removal of in https://github.com//github-terraform-repository via https://github.com//github-terraform-repository/actions/runs/###### reached across orgs and deleted it from the github.com/ org, which is unexpected.

PAT used for this DOES have access to both orgs, however, I didn't expect a change in terraform in one org to reach across org boundaries find the repo in it's "new home" and remove it from there.

Debug Output

Panic Output

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions