-
Notifications
You must be signed in to change notification settings - Fork 763
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
Cannot create repository with 'visibility: private' in an organisation that does not allow public repositories #669
Comments
Relates to #580. Thanks for boosting the signal here and providing this amount of detail 🙇🏾 . |
I would say you are hitting this like me; google/go-github#1786 |
ignore my last comment, found it here; #680 |
I am encountering the same problem. However I can set the deprecated |
Will this be fixed by #781? |
👋 Hey Friends, this issue has been automatically marked as |
Terraform Version
Terraform v0.14.3
Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
See Details section below
Expected Behavior
Terraform will create a private repository.
Actual Behavior
403
returned.Details
It seems that it is not possible to create a repository using the
github_repository
resource with thevisibility = "private"
paramater in an organisation where members are not allowed to createpublic
repositories.After some debug this is because the provider initially creates a public repo, and quickly makes a PATCH call to the GitHub API to switch it from public to private.
Running with
TF_LOG
and truncated for brevity:I've tested all this directly through the API. The error returned is coming directly from the GitHub API: when you try to create a public repo when only private repos are allowed you get a 403:
This is not a useful message, it should read something like
"message": "You cannot create a public repository in this organization unless you are an organization admin."
, because organisation owners can still create public repos, when other members can't.Anyway, is there something I'm missing? If not, is there a particular reason that the provider first creates a public repository and then change the visibility? You can pass
"visibility": "private"
on the initialPOST
request and this would solve this issue.As an example:
I've never contributed to a terraform provider before but if someone points me in the right direction I'm happy to try and do so to fix this issue; but if someone else wants to pick it up then that is cool too.
The text was updated successfully, but these errors were encountered: