Skip to content

Commit

Permalink
return codes
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Apr 29, 2025
1 parent 092527f commit 08b1073
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config_job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ locals {
GRANT
execute_sql_as_postgres "$SQL_GRANT"
echo "Metrics permissions granted"
return 0
}
# Wait for PostgreSQL to be ready
Expand Down Expand Up @@ -97,6 +98,7 @@ GRANT
"$KC_URL/auth/admin/realms"
echo "Realm $realm_name created"
return 0
}
# Create admin user in realm
Expand Down Expand Up @@ -128,6 +130,7 @@ GRANT
"$KC_URL/auth/admin/realms/$realm/users/$user_id/reset-password"
echo "User $username created and password set"
return 0
}
# Create a realm role
Expand All @@ -151,6 +154,7 @@ GRANT
"$KC_URL/auth/admin/realms/$realm/roles"
echo "Role $role_name created"
return 0
}
# Add realm role to user
Expand Down Expand Up @@ -179,6 +183,7 @@ GRANT
"$KC_URL/auth/admin/realms/$realm/users/$user_id/role-mappings/realm"
echo "Role $role_name added to user $username"
return 0
}
# Create a client
Expand Down Expand Up @@ -207,6 +212,7 @@ GRANT
"$KC_URL/auth/admin/realms/$realm/clients"
echo "Client $client_id created"
return 0
}
# Get client ID by client_id
Expand All @@ -217,6 +223,7 @@ GRANT
curl -s \
-H "Authorization: Bearer $KC_TOKEN" \
"$KC_URL/auth/admin/realms/$realm/clients?clientId=$client_id"
return 0
}
# Add protocol mapper to client
Expand All @@ -237,6 +244,7 @@ GRANT
"$KC_URL/auth/admin/realms/$realm/clients/$client_id/protocol-mappers/models"
echo "Mapper $name added to client $client_id"
return 0
}
# Start configuration process
Expand Down Expand Up @@ -286,6 +294,7 @@ GRANT
restart_server
echo "Keycloak configuration completed successfully"
return 0
CONFIG
}

0 comments on commit 08b1073

Please sign in to comment.