53 lines
1.4 KiB
HCL
53 lines
1.4 KiB
HCL
resource "random_id" "forgejo_client_id" {
|
|
byte_length = 16
|
|
}
|
|
|
|
resource "authentik_provider_oauth2" "forgejo" {
|
|
name = "Forgejo"
|
|
# Required. You can use the output of:
|
|
# $ openssl rand -hex 16
|
|
client_id = random_id.forgejo_client_id.id
|
|
|
|
# Optional: will be generated if not provided
|
|
# client_secret = "my_client_secret"
|
|
|
|
authorization_flow = data.authentik_flow.default-provider-authorization-implicit-consent.id
|
|
|
|
redirect_uris = [
|
|
"https://code.lab.cowley.tech/user/oauth2/authentik/callback"
|
|
]
|
|
property_mappings = [
|
|
data.authentik_property_mapping_provider_scope.scope-email.id,
|
|
data.authentik_property_mapping_provider_scope.scope-profile.id,
|
|
data.authentik_property_mapping_provider_scope.scope-openid.id,
|
|
]
|
|
lifecycle {
|
|
ignore_changes = [
|
|
signing_key,
|
|
authentication_flow,
|
|
]
|
|
}
|
|
}
|
|
|
|
resource "authentik_application" "forgejo" {
|
|
name = "ForgeJo"
|
|
slug = "forgejo"
|
|
protocol_provider = authentik_provider_oauth2.forgejo.id
|
|
}
|
|
|
|
resource "authentik_group" "forgejo-admins" {
|
|
name = "gitadmin"
|
|
}
|
|
resource "authentik_group" "forgejo-users" {
|
|
name = "gituser"
|
|
}
|
|
resource "kubernetes_secret" "forgejo-oauth" {
|
|
metadata {
|
|
name = "forgejo-oauth"
|
|
namespace = "forgejo"
|
|
}
|
|
data = {
|
|
"key" = authentik_provider_oauth2.forgejo.client_id
|
|
"secret" = authentik_provider_oauth2.forgejo.client_secret
|
|
}
|
|
}
|