Build, test, and extend provider-keycloak — a Crossplane provider that manages Keycloak (IAM/SSO) resources as Kubernetes custom resources.
Resources
15Install
npx skillscat add crossplane-contrib/provider-keycloak Install via the SkillsCat registry.
This skill provides the tools to build, test, and extend the provider-keycloak Crossplane provider. It enables developers to manage Keycloak IAM and SSO resources as Kubernetes custom resources by leveraging Upjet and the Keycloak Terraform provider. Use this skill when developing or maintaining the provider's codebase, regenerating CRDs, or running end-to-end tests.
provider-keycloak Skill
provider-keycloak is a Crossplane provider generated with
Upjet from the
Keycloak Terraform Provider.
It reconciles Kubernetes CRDs against a live Keycloak instance.
Quick Reference
# Regenerate CRDs + Go types after changing config/
make generate
# Run unit tests
make test
# Preview docs locally
cd docs && hugo server --buildDrafts
# Regenerate llms.txt / llms-full.txt
make docs-gen
# Verify docs freshness (CI gate)
make docs-freshness-checkBuild and Test
make generate # regenerate after config/ changes
make test # unit tests
make e2e # end-to-end tests (requires live cluster + Keycloak)Key Files
| File | Purpose |
|---|---|
config/external_name.go |
Maps Terraform resource names to Keycloak-side identifiers |
config/<group>/config.go |
Cross-resource references, import config, custom behaviors |
generate/main.go |
Entry point for Upjet code generation |
cluster/test/cases.txt |
Resources covered by E2E tests |
docs/scripts/gen-llms.sh |
Generates llms.txt and llms-full.txt |
Conventions
- Never edit files in
apis/orpackage/crds/by hand — they are generated outputs. - Never edit
examples-generated/by hand. - Always run
make generateafter changingconfig/. - Do not add
+nullablemarkers to generated types (Upjet does not support them). - Do not let both a
Membershipsresource and aGroupsresource withexhaustive=true
manage the same group's membership simultaneously — they will conflict. github.com/keycloak/terraform-provider-keycloakmust not be updated via Renovate;
it requires deliberate schema migration.
Adding a New Resource
- Add entry to
config/external_name.go. - Create/update
config/<group>/config.gowith references and optional lookup config. - Run
make generate. - Add example to
examples/<group>/<resource>.yaml. - Optionally add docs page to
docs/content/docs/using/resources/<resource>.md.
Cross-Resource References
// In config/<group>/config.go
r.References["realm_id"] = config.Reference{
TerraformName: "keycloak_realm",
}Import / Identify by Properties
To avoid 409 errors on create when a resource already exists in Keycloak,
wire the resource to lookup.BuildIdentifyingPropertiesLookup (seeconfig/openidclient/config.go for a full example).