From 049e2d339b3ae871252f102418c167f4f1f4e344 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Fri, 22 Dec 2023 15:44:02 +0100 Subject: [PATCH] Keep default roles for users with additional roles --- tf-stage-1/main.tf | 5 +++++ tf-stage-1/user_rad4day.tf | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tf-stage-1/main.tf b/tf-stage-1/main.tf index 03a6b3f..5470d4f 100644 --- a/tf-stage-1/main.tf +++ b/tf-stage-1/main.tf @@ -25,3 +25,8 @@ terraform { data "keycloak_realm" "realm" { realm = var.realm } + +data "keycloak_role" "default_role" { + realm_id = data.keycloak_realm.realm.id + name = "default-roles-tobiasmanske.de" +} diff --git a/tf-stage-1/user_rad4day.tf b/tf-stage-1/user_rad4day.tf index 38da263..09be196 100644 --- a/tf-stage-1/user_rad4day.tf +++ b/tf-stage-1/user_rad4day.tf @@ -22,10 +22,11 @@ resource "keycloak_user_groups" "rad4day_groups" { resource "keycloak_user_roles" "rad4day_roles" { - realm_id = data.keycloak_realm.realm.id - user_id = data.keycloak_user.rad4day.id + realm_id = data.keycloak_realm.realm.id + user_id = data.keycloak_user.rad4day.id role_ids = [ + data.keycloak_role.default_role.id, keycloak_role.minio-consoleAdmin.id, ] }