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

Add support for gitea deploy keys. #20

Closed martin31821 closed 1 year ago

martin31821 commented 1 year ago

I'd like to manage deploy keys for specific repositories. I have a SSH key generated with terraform TLS provider and would like to have the public part as deploy key for a specific project.

Describe the solution you'd like something like:

resource "tls_private_key" "my_deploy_key" {
  type = "RSA"
  rsa_bits = 4096
}

resource "gitea_repository" "my_repo" {
  name = "my_repo"
  private = true
}

resource "gitea_deploy_key" "my_repo_deploy" {
  repository = gitea_repository.my_repo.name
  key = tls_private_key.my_deploy_key.public_key_openssh
}
Lerentis commented 1 year ago

Hi @martin31821 ,

This is a good idea. Looking at the gitea go sdk this also seems rather straightforward to implement. That said I will probably not have a lot of time to implement this as my son has been born a few weeks ago 😅

I will pick this up if I find some time, but if anyone else wants to take this; pull requests welcome (:

martin31821 commented 1 year ago

Congratulations! If you don't mind, i'd prepare a PR since I have more stuff I want/need to add, but not all of it has a proper API endpoint (e.g. configuring authentication sources like OIDC)

Lerentis commented 1 year ago

Thanks (: I'll be happy to review it, but please keep it to one feature per pr 😅

In regards to features that are not covered by the gitea sdk, I envisioned some time ago a factory similar what is done in the sdk itself. For features that do not have an api endpoint at all, you probably need to raise this to the gitea maintainers and we can follow up here at a later time