Lerentis / terraform-provider-gitea

Terraform Provider for your Gitea Instance
https://registry.terraform.io/providers/Lerentis/gitea/latest
MIT License
22 stars 11 forks source link

implement gitea_fork #8

Closed juddowilcox closed 1 year ago

juddowilcox commented 1 year ago

This would close https://github.com/Lerentis/terraform-provider-gitea/issues/6

juddowilcox commented 1 year ago

In regards to your question whether this should be a dedicated resource or, instead, just added functionality to the existing repository resource... I thought about this for a while and, to me, a dedicated resource made more sense because you can only fork an existing repository and you cannot fork it in the same namespace (owner/org) as its source. I doubt that I'd be able to work out the logic of when a fork was/was not possible in the repository resource and, even if I could, it would unnecessarily complicate that resource. It also seemed to me that it was desirable to maintain the parallel with the sdk: https://gitea.com/gitea/go-sdk/src/branch/release/v0.15/gitea/fork.go. This second point may be a symptom of my inexperience with go.

Lerentis commented 1 year ago

I had a look at the API and followed down the rabbit hole why it is implemented as it is today and looking what i found, your implementation makes sense. that said there is a very limited functionality which i would like to have at least documented:

creating a fork for another user as admin (which i hoped would be implemented in the gitea sdk) is only possible by using the API directly with the sudo header which is not ideal here. i'll have a look at a later point in time if i can implement this logic to extend this resource.