MatthewJohn / terrareg

Open source Terraform module registry with UI, optional Git integration and deep analysis
https://gitlab.dockstudios.co.uk/pub/terrareg
GNU General Public License v3.0
268 stars 20 forks source link

Use PAT token for Git based hosting #57

Closed aca8089 closed 1 month ago

aca8089 commented 1 month ago

For git based hosting how can we use PAT tokens instead of SSH key.

@MatthewJohn Can you please help with this

MatthewJohn commented 1 month ago

Created gitlab issue: https://gitlab.dockstudios.co.uk/pub/terrareg/-/issues/535 gitlab-issue-id:535

aca8089 commented 1 month ago

Also does this support Azure Repos ?

MatthewJohn commented 1 month ago

Hey @aca8089, From Terrareg's point of view, it will take any git URL, the only requirements are:

With regards to PAT tokens, is this about using PAT tokens instead of SSH keys for Terrareg or the users of the modules? If it's the users, I would assume the best way would be to use a Git credential helper.

With regards to Terrareg, if you'd want to use PAT tokens for indexing, would these be assigned per-repository or globally across the instance?

With regards to Azure (since I haven't used it before), does it do anything special with authentication (does SSH key access work?) - unless it does do something special, I see no reason why it wouldn't work.

aca8089 commented 1 month ago

Hi @MatthewJohn Thanks for the reply.

Actually I was trying to use the git based hosting in terrareg but instead of adding SSH keys in the GitHub/Azure repository, I was thinking to use access tokens which is the recommended way.

MatthewJohn commented 1 month ago

I've had a quick go at implementing this this morning: https://gitlab.dockstudios.co.uk/pub/terrareg/-/merge_requests/413 It basically allows authentication for http(s) repositories via a globally set username/password. Hope this fixes the use-case

Many thanks Matt

aca8089 commented 1 month ago

@MatthewJohn Thanks for the changes.

Are we planning for merging the code soon ?

MatthewJohn commented 1 month ago

@MatthewJohn Thanks for the changes.

Are we planning for merging the code soon ?

Hey,

Yep, I'm just pleading with tests :)

MatthewJohn commented 1 month ago

This is now released in 3.10.0 :)