Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Cannot set owner when authenticating with gh cli #1966

Closed
1 task done
steveoh opened this issue Oct 17, 2023 · 4 comments
Closed
1 task done

[BUG]: Cannot set owner when authenticating with gh cli #1966

steveoh opened this issue Oct 17, 2023 · 4 comments
Labels
Status: Stale Used by stalebot to clean house Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@steveoh
Copy link

steveoh commented Oct 17, 2023

Expected Behavior

when I set the owner in the provider, all actions should be taken on repositories in that org.

Actual Behavior

api requests go to my personal accounts org

Terraform Version

Terraform v1.5.7
on darwin_amd64

  • provider registry.terraform.io/hashicorp/github v5.40.0
  • provider registry.terraform.io/hashicorp/google v5.2.0
  • provider registry.terraform.io/hashicorp/google-beta v5.2.0
  • provider registry.terraform.io/hashicorp/local v2.4.0
  • provider registry.terraform.io/integrations/github v5.40.0

Affected Resource(s)

  • github_actions_environment_secret

Terraform Configuration Files

provider "github" {
  owner = "my-org"
}

resource "github_repository_environment" "prod" {
  environment = "prod"
  repository  = "repo"

  reviewers {
    users = [
      data.github_user.one.id,
      data.github_user.two.id,
      data.github_user.three.id
    ]
  }

  deployment_branch_policy {
    protected_branches     = false
    custom_branch_policies = true
  }
}

Steps to Reproduce

with the gh cli installed, add a github_repository_environment and some github_actions_environment_secret to an existing repository.

Apply the plan.

Debug Output

Error: PUT https://api.github.com/repos/wrong-owner/repo/environments/prod: 404 Not Found []

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@steveoh steveoh added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Oct 17, 2023
@steveoh
Copy link
Author

steveoh commented Oct 17, 2023

This only happens when using

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
    }
  }
}

which sets the new provider. The hashicorp provider does not have this bug.

@kfcampbell kfcampbell moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Oct 20, 2023
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Oct 20, 2023
@steveoh
Copy link
Author

steveoh commented Oct 26, 2023

@kfcampbell can you point me and others in the right direction so we can be successful to implement the fix? I ask since you marked this as up for grabs which to me implies it's not a priority for the maintainers.

@kfcampbell
Copy link
Member

I don't have a confident answer on what the right direction here is. It's probably related to #1655 as well; frequently our resources take the owner of the token instead of a specified owner.

Copy link

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Jul 24, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2024
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Used by stalebot to clean house Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants