terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG]: Not able to create a new user anymore

Open virvirlopez opened this issue 1 year ago • 4 comments
trafficstars

Expected Behavior

Hello, we have the following code to create new users:

resource "github_membership" "members" {
  for_each = yamldecode(file("./yaml_files/users.yml"))["users"]

  username = lookup(each.value, "username", null)
  role     = lookup(each.value, "role", "member")
}

It has been working until now.

Actual Behavior

When I try to create a new user I get: PUT https://api.github.com/orgs/<ORGANIZATION>: 403 You must be an admin to add or update an organization membership.

But I am an owner and I am able to create users through the UI. For applying the changes, I am login in with:

gh auth login -w

Terraform Version

  source  = "registry.opentofu.org/integrations/github"
  version = "6.2.2"

opentofu version: 1.6.2

Affected Resource(s)

  • github user creation

Terraform Configuration Files

No response

Steps to Reproduce

terraform apply

Debug Output

No response

Panic Output

No response

Code of Conduct

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

virvirlopez avatar Jul 17 '24 07:07 virvirlopez

What version did this start happening with? I wonder if this is a result of #2304.

kfcampbell avatar Jul 19 '24 21:07 kfcampbell

We are having a similar issue here, when trying to add a user to the org in our case, we get a: Error: PUT https://api.github.com/orgs/wethegit/memberships/user-name: 403 You must be an admin to add or update an organization membership. []

marlonmarcello avatar Jul 23 '24 21:07 marlonmarcello

Running into this when trying to change a users role. I am authenticated with the gh cli tool. I am an owner of the org and can make these changes via the UI. Running the following versions:

> tofu --version
OpenTofu v1.7.3
on linux_amd64
+ provider registry.opentofu.org/integrations/github v6.2.3

d-xo avatar Jul 25 '24 19:07 d-xo

Resolved in my case by adding admin:org to the gh token scopes (eg via gh auth refresh --scopes admin:org).

clonker avatar Jul 31 '24 13:07 clonker

👋 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[bot] avatar Apr 28 '25 02:04 github-actions[bot]