From eb9596d527217c60328efc0eaf874e1a51c06337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Huss?= Date: Wed, 24 Jan 2024 14:49:36 +0100 Subject: [PATCH] adding secrets values as output for oauth2 modules --- oauth2/oauth2.tf | 8 ++++++++ oauth2/outputs.tf | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/oauth2/oauth2.tf b/oauth2/oauth2.tf index 99fa9f0..e5699d9 100644 --- a/oauth2/oauth2.tf +++ b/oauth2/oauth2.tf @@ -65,6 +65,14 @@ resource "kubernetes_secret_v1" "oauth2-client-secret" { } } +data "kubernetes_secret_v1" "oauth2-client-secret" { + depends_on = [kubectl_manifest.oauth2-client-secret] + metadata { + name = kubectl_manifest.oauth2-client-secret.name + namespace = var.namespace + } +} + data "kubernetes_ingress_v1" "authentik" { metadata { name = "authentik" diff --git a/oauth2/outputs.tf b/oauth2/outputs.tf index 79792c3..bd5e0ae 100644 --- a/oauth2/outputs.tf +++ b/oauth2/outputs.tf @@ -5,3 +5,9 @@ output "provider-id" { output "sso_configuration_url" { value = "https://${data.kubernetes_ingress_v1.authentik.spec[0].rule[0].host}/application/o/${var.component}-${var.instance}" } +output "client_id" { + value = data.kubernetes_secret_v1.oauth2-client-id.data["client-id"] +} +output "client_secret" { + value = data.kubernetes_secret_v1.oauth2-client-secret-id.data["client-secret"] +}