Closed Breee closed 1 year ago
It should be possible to use the random provider to generate the secret, add the time_rotating to the keepers and set random result as client_secret on the keycloak resource.
https://registry.terraform.io/providers/hashicorp/random/latest/docs#resource-keepers
It should be possible to use the random provider to generate the secret, add the time_rotating to the keepers and set random result as client_secret on the keycloak resource.
https://registry.terraform.io/providers/hashicorp/random/latest/docs#resource-keepers
thx
resource "time_rotating" "secret_rotation_days" {
rotation_days = 120
}
resource "random_string" "client_secret" {
length = 32
special = false
keepers = {
rotation_days = time_rotating.secret_rotation_days.id
}
}
resource "keycloak_openid_client" "openid_client" {
realm_id = data.keycloak_realm.realm.id
name = var.service_name
description = "Client for ${var.service_root_url}"
client_id = var.service_name
client_secret = random_string.client_secret.result`
[...]
}
does the trick!
Currently it is not possible to rotate the secrets of clients automatically.
It would be great if clients would support something similar to this:
where
rotate_secret_when_changed
checks if the id of thetime_rotating
object has changed and generates a new secret if so.