Keycloak
Keycloak — self-hosted OIDC realms, users, roles
weave keycloak
Env: KEYCLOAK_URL
Setup
Configure credentials via environment variables. We recommend sourcing them through 1Password or your secrets manager rather than committing them to the shell rc.
Official API reference
weave commands for this module are checked against the vendor's published API.
| Variable | Description | Status |
|---|---|---|
| KEYCLOAK_URL | Required for authentication. | required |
| KEYCLOAK_TOKEN | Required for authentication. | required |
Sanity-check the wiring:
weave secrets check weave keycloak --help weave doctor # reports KEYCLOAK_URL status
Capabilities
What this module can do, by entity and verb. ✓
means a working CLI surface; · means
not (yet) wired.
| Entity | find | list | show | do | snapshot | diff | apply |
|---|---|---|---|---|---|---|---|
| realm | · | ✓ | · | · | · | · | · |
| user | ✓ | ✓ | · | · | ✓ | ✓ | ✓ |
Commands
Every registered CLI command, grouped by verb. Each example uses placeholder arguments — substitute real values for your environment.
find (1)
find user
readFind a user by email, username, or Keycloak user id.
weave keycloak find user <identifier>
list (2)
list realms
readList all realms (admin root API).
weave keycloak list realms <arg>
list users
readList users in the configured realm.
weave keycloak list users <arg>
snapshot → edit YAML →
diff → apply --yes (or confirm
interactively; apply --dry-run previews the same diff).
State kinds
Resources this module can snapshot and
diff; apply where the kind supports
live writes (see Round-trip per kind). Always run
diff before apply; use
--yes in automation after review. Files live under
.weave-state/keycloak/.
users
keycloak users — field-level apply via REST.
State file skeleton
module: keycloak kind: users items: - # <fields specific to this kind — see snapshot output>
Workflows
End-to-end recipes from operators who already run this module in production. Copy, adapt, and put under change-control.
Users audit
Snapshot, diff, and apply users.
weave keycloak snapshot users $EDITOR .weave-state/keycloak/users.yaml weave keycloak diff users weave keycloak apply users
Terraform parity
For each Terraform resource in the canonical provider, here's the equivalent live-API verb in weave. Use this as a migration cheat-sheet, not a 1:1 contract — weave deliberately stays in the live-state lane, not the desired-state lane.
| Terraform resource | weave equivalent |
|---|---|
| keycloak_users | weave keycloak snapshot/diff/apply users Round-trip via weave state. |
Troubleshooting & source
Run weave doctor — it reports which env
vars (including KEYCLOAK_URL) are set
and which are blank.
Re-run weave keycloak diff <kind>
to confirm the controller's current state, then re-snapshot
before the next apply. The driver always re-snapshots
before diffing.
The module lives at https://github.com/andy-broyles/weavewhatever/tree/main/src/weave/modules/keycloak. File a bug or feature request at https://github.com/andy-broyles/weavewhatever/issues.