terraform-provider-github
terraform-provider-github copied to clipboard
[BUG]: Not able to create a new user anymore
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
What version did this start happening with? I wonder if this is a result of #2304.
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. []
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
Resolved in my case by adding admin:org to the gh token scopes (eg via gh auth refresh --scopes admin:org).
👋 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!