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

fix(resource_github_repository): Create repo from template with visibility to avoid org policy issue

Open littlelionking opened this issue 1 year ago • 2 comments

Resolves #925


Before the change?

When creating a repository from a template, it sets the visibility to either public or private according to this bool:

Private:            github.Bool(isPrivate),

And then edits the repo settings later to ensure the visibility is correct.

After the change?

Now it sets the Visibility parameter instead, allowing "internal" as an option.

Pull request checklist

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [x] Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • [x] No

littlelionking avatar Feb 16 '24 02:02 littlelionking

Hi @kfcampbell / @nickfloyd would I be able to get your thoughts on this?

littlelionking avatar May 21 '24 15:05 littlelionking

Hey @littlelionking,

Given this resource is core to this provider we're going to need automated tests. Also, please add documentation for the repo resource when you get the chance.

Closed my PR as I am not likely to work on this. I think I'll be moving away from using terraform-provider-github's template.

The testOrganization seems to be set by an environment variable and I didn't see an api option to set the org policy. So I think it might need test infrastructure changes to fail without the fix... which I think would be faster for a github member to do. Would you be fine with this but replacing "private" with "internal?" https://github.com/integrations/terraform-provider-github/blob/e6660d4fd3b75b743ec00b8432f1a4a912154da5/github/resource_github_repository_test.go#L1518-L1566

@nickfloyd

littlelionking avatar Aug 07 '24 15:08 littlelionking