diff --git a/modules/user_auth/README.md b/modules/user_auth/README.md index e22569f..02bbcc0 100644 --- a/modules/user_auth/README.md +++ b/modules/user_auth/README.md @@ -40,6 +40,7 @@ No requirements. | frontend\_service\_domain | Domain of the frontend | `string` | n/a | yes | | jwks\_content | The content of a JWKS file for Oathkeeper | `string` | n/a | yes | | k8s\_local\_exec\_context | Custom resource (Oathkeeper Rules are created using local-exec with kubectl), if not specified it will target your current context from kubeconfig | `string` | `""` | no | +| kratos\_default\_redirect\_ui\_path | Setting the default path after self-service flows(login/signup/verify/settings), kratos will redirect you to frontend | `string` | `"/dashboard"` | no | | kratos\_secret\_name | Secret name for kratos to access Database credentials, created from pre-k8s script | `string` | n/a | yes | | kratos\_values\_override | a map of parameters to override the kratos-values.yml | `map(any)` | `{}` | no | | kubectl\_extra\_args | Arguments that will be passed to kubectl when using the local executor in cases where the terraform k8s support is not enough | `string` | n/a | yes | diff --git a/modules/user_auth/main.tf b/modules/user_auth/main.tf index 303b7da..05df50d 100644 --- a/modules/user_auth/main.tf +++ b/modules/user_auth/main.tf @@ -14,6 +14,7 @@ locals { } } + default_flow_return_url = "https://${var.frontend_service_domain}${var.kratos_default_redirect_ui_path}" kratos_values_override = { secret = { nameOverride = var.kratos_secret_name @@ -36,40 +37,40 @@ locals { settings = { ui_url = "https://${var.frontend_service_domain}/auth/settings" after = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url } } verification = { ui_url = "https://${var.frontend_service_domain}/auth/verify" after = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url } } recovery = { ui_url = "https://${var.frontend_service_domain}/auth/recovery" after = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url } } login = { ui_url = "https://${var.frontend_service_domain}/auth/login" after = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url } } registration = { ui_url = "https://${var.frontend_service_domain}/auth/registration" after = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url password = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url } oidc = { - default_browser_return_url = "https://${var.frontend_service_domain}/dashboard" + default_browser_return_url = local.default_flow_return_url } } } @@ -94,8 +95,6 @@ locals { proxy = { hosts = [var.backend_service_domain] tls = { - // HCL doesnt allow map inside a list, you will get the following error with a list - // `<.host>: can't evaluate field host in type interface {}` "0" = { host = [var.backend_service_domain] } @@ -162,8 +161,8 @@ resource "null_resource" "external_secret_custom_resource" { } module "kratos_config" { - source = "cloudposse/config/yaml" - version = "0.7.0" + source = "cloudposse/config/yaml" + version = "0.7.0" map_config_local_base_path = "${path.module}/files" map_config_paths = ["kratos-values.yml"] @@ -217,8 +216,8 @@ resource "null_resource" "oathkeeper_kratos_proxy_rules" { } module "oathkeeper_config" { - source = "cloudposse/config/yaml" - version = "0.7.0" + source = "cloudposse/config/yaml" + version = "0.7.0" map_config_local_base_path = "${path.module}/files" map_config_paths = ["oathkeeper-values.yml"] diff --git a/modules/user_auth/variables.tf b/modules/user_auth/variables.tf index 1159b83..d5561a9 100644 --- a/modules/user_auth/variables.tf +++ b/modules/user_auth/variables.tf @@ -87,3 +87,9 @@ variable "oathkeeper_values_override" { type = map(any) default = {} } + +variable "kratos_default_redirect_ui_path" { + description = "Setting the default path after self-service flows(login/signup/verify/settings), kratos will redirect you to frontend" + type = string + default = "/dashboard" +}