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

Add owner attribute for repository resource

Open tdabasinskas opened this issue 2 years ago • 5 comments

An attempt to fix #1702.

The lack of ability to specify owner for an individual repository resource makes this provider pretty much unusable in a GHES environment containing over 300 organizations – having a separate provider for every single organization is probably not a great idea.

I'm not sure my solution is ideal – the current code is quite biased on the owner being resolved automatically, so it's a bit challenging to add support for an explicit owner without introducing a breaking change.

I've tested this quite extensively manually – seems to be working as expected. If someone could help with adding some tests to confirm this, I would appreciate. Also, these changes should be applied to all repository_ resources, but prior to doing that, I wanted to get some feedback.


Before the change?

  • repository resource uses owner specified at the provider level.

After the change?

  • repository resource supports an optional owner argument.
  • If the argument is provided, the resource is managed under that specific owner.
  • If the argument is not provided, the owner defined at the provider level is used.

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!

  • [ ] Yes
  • [X] No

tdabasinskas avatar Aug 08 '23 16:08 tdabasinskas

This seems like a good approach to the change to me, though I also feel somewhat uncomfortable without integration tests.

kfcampbell avatar Aug 11 '23 20:08 kfcampbell

Hey @tdabasinskas, just a quick follow up. Is this something that you are interested in wrapping up? I think the remaining items are:

  • @kfcampbell left a quick suggestion on the docs
  • Some integration tests if you get the chance

Thanks again for making things better for the community here! ❤️

nickfloyd avatar Oct 16 '23 21:10 nickfloyd

Hi @nickfloyd,

Sorry for dropping a ball on this.

I've updated the docs as per @kfcampbell proposal. However, I'm not sure when I could do the integration tests, and, more importantly, add this to all the rest of repository-related resources. Being able to set owner only for repository resource but still requiring dedicated providers for all other resources, is not ideal 😕

tdabasinskas avatar Oct 17 '23 05:10 tdabasinskas

Being able to set owner only for repository resource but still requiring dedicated providers for all other resources, is not ideal 😕

I definitely agree with this take, and this is something the provider can stand to do a lot better on. We'd definitely be receptive to anybody wanting to continue this work.

kfcampbell avatar Oct 17 '23 18:10 kfcampbell

Hey every, just a heads up - I merged this branch into my own and am continuing this work there. Feedback welcome!

avidspartan1 avatar Feb 05 '24 21:02 avidspartan1