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

[MAINT]: github_organization_settings always tries to update internal_repo setting regardless of enterprise plan

Open propyless opened this issue 2 years ago • 10 comments

Describe the need

We cannot used the resource github_organization-settings due to a bug that occurs when we don't have a enterprise account. We are currently on a Enterprise Plan and therefore do not have access to internal repositories since we have not purchased enterprise account.

The argument to the resource is members_can_create_internal_repositories. We can not set this to either false or null or not define the argument at all, but seem to be hitting the same API validation error in all cases.

We expect that the enterprise account settings are not triggered for enterprise plan GitHub organizations.

SDK Version

terraform-provider-github v5.10.0

API Version

No response

Relevant log output

Error: PATCH https://api.github.com/orgs/xxx: 422 Validation Failed []
│ 
│   with github_organization_settings.xxx,

2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0: 
2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0: {
2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0:  "message": "Validation Failed",
2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0:  "errors": "This organization does not support internal repositories.",
2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0:  "documentation_url": "https://docs.github.com/rest/reference/orgs#update-an-organization"
2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0: }
2022-11-30T09:14:37.759+0100 [DEBUG] provider.terraform-provider-github_v5.10.0: -----------------------------------------------------
2022-11-30T09:14:37.769+0100 [ERROR] vertex "github_organization_settings.xxx" error: PATCH https://api.github.com/orgs/xxx: 422 Validation Failed []

Code of Conduct

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

propyless avatar Nov 30 '22 08:11 propyless

Oh shoot, that's obnoxious. @propyless do you have any interest in opening a PR to fix this behavior?

kfcampbell avatar Nov 30 '22 23:11 kfcampbell

Yes it is certainly a bummer. I would have loved to, but I haven't written any go code yet so it would take me a long time I think. Not much experience with compiled languages.

I created this issue by request from https://github.com/integrations/terraform-provider-github/issues/1324#event-7905106709 and @kuhlman-labs said that he would look at it once the issue was created.

propyless avatar Dec 01 '22 13:12 propyless

@propyless Thank you for opening this, I will take a look and update once I have a PR submitted.

kuhlman-labs avatar Dec 01 '22 13:12 kuhlman-labs

@kuhlman-labs Thank you for having a look at this. Did you make any progress?

Jeinhaus avatar Mar 06 '23 14:03 Jeinhaus

@kuhlman-labs Have you had any time to look at this task?

propyless avatar Apr 26 '23 08:04 propyless

Anyone have time, we are still very interested in automating org settings.

propyless avatar Jan 04 '24 11:01 propyless

I think developing this for a non-github engineer is difficult since this resource should work and be tested in the "free", "teams", "enterprise plan" and "enterprise account" contexts. This would require a significant investment to develop this feature. I would be willing to implement this if i were to be added to 4 example organisations like this @kfcampbell. Otherwise i think its best if someone at github does this.

rwblokzijl avatar Jan 09 '24 13:01 rwblokzijl

We don't have ready test versions of those accounts, which is part of the reason why our automated testing is so poor at the moment. Please feel free to implement it if you'd like! I can scrounge around and figure out what resources might be available to us.

kfcampbell avatar Jan 18 '24 23:01 kfcampbell

We don't have ready test versions of those accounts, which is part of the reason why our automated testing is so poor at the moment. Please feel free to implement it if you'd like! I can scrounge around and figure out what resources might be available to us.

If I get 4 personal access tokens that have owner access in 4 different test orgs/enterprises, i'll be happy to develop this.

rwblokzijl avatar Jan 19 '24 13:01 rwblokzijl