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

Support `gitea_oauth2_app` `confidential_client` flag #46

Closed deblasis closed 1 year ago

deblasis commented 1 year ago

Hi there, thank you for this provider!

I found out that there's a missing field in gitea_oauth2_app.

https://try.gitea.io/api/swagger#/user/userCreateOAuth2Application image

Currently it's implicitly passed as false therefore creating apps that require PKCE. This PR simply allows the consumer to configure the value.

From the swagger file above it looks like the default should be true, not a big deal but I think it's worth mentioning it. If we set the default to true it would be a breaking change since it could break some consumers that might expect it to false since now it's ignored.

Reference: https://docs.gitea.com/next/development/oauth2-provider#confidential-client

Lerentis commented 1 year ago

Hi @deblasis , thanks for raising and picking this up already. you probably want to raise this to https://gitea.com/gitea/go-sdk as well as i am just using this SDK under the hood and you changed it there 😃

deblasis commented 1 year ago

Hi @deblasis , thanks for raising and picking this up already. you probably want to raise this to https://gitea.com/gitea/go-sdk as well as i am just using this SDK under the hood and you changed it there 😃

HI @Lerentis, fair point. I have just raised this FYI:

https://gitea.com/gitea/go-sdk/pulls/625

deblasis commented 1 year ago

Hi @Lerentis, in the end... I learnt how to debug terraform providers 😀

I identified the bug, unrelated to my changes but regardless, here's the fix: https://github.com/Lerentis/terraform-provider-gitea/pull/46/commits/2d7147442bbfd0c613bfe2c6d42c1e8194c3b494

The cause is just incorrect variable scope in the "update path".

Demo:

https://github.com/Lerentis/terraform-provider-gitea/assets/29378614/8bad7cff-0964-4d99-8997-53bbf58fd93d

Lerentis commented 1 year ago

woah kudos for finding this and fixing this as well 💯