Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/user_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
25 changes: 12 additions & 13 deletions modules/user_auth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
}
Expand All @@ -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 {}`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somehow with the comments terraform errors out 😢

"0" = {
host = [var.backend_service_domain]
}
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down
6 changes: 6 additions & 0 deletions modules/user_auth/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}