On GitHub, keycloak/terraform-provider-keycloak has picked up 960 stars, Developer Tools, Go. Terraform provider for Keycloak
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
If you are using Terraform 0.12, you can use this provider by downloading it and placing it within
one of the implied local mirror directories.
Or, follow the old instructions for installing third-party plugins.
If you are using any provider version below v2.0.0, you can also follow the old instructions for installing third-party plugins.
A note for users of the legacy Wildfly distribution
Recently, Keycloak has been updated to use Quarkus over the legacy Wildfly distribution. The only significant change here
that affects this Terraform provider is the removal of /auth from the default context path for the Keycloak API.
If you are using the legacy Wildfly distribution of Keycloak, you will need to set the base_path provider argument to
/auth. This can also be done by using the KEYCLOAK_BASE_PATH environment variable.
Supported Versions
This provider will officially support the latest three minor versions of Keycloak, although older versions may still work.
The following versions are used when running acceptance tests in CI:
26.8.2 (latest)
26.7.5
26.6.4
26.5.7
26.4.7
26.3.5
26.2.5
26.1.4
26.0.8
Releases
This provider uses GoReleaser to build and publish releases. Each release published to GitHub
contains binary files for Linux, macOS (darwin), and Windows, as configured within the .goreleaser.yml
file.
Each release also contains a terraform-provider-keycloak_${RELEASE_VERSION}_SHA256SUMS file that can be used to check integrity.
You can find the list of releases here.
You can find the changelog for each version here.
Note: Prior to v2.0.0, a statically linked build for use within Alpine linux was included with each release. This is no longer
done due to GoReleaser not supporting CGO. Instead of using a statically linked,
build you can use the linux_amd64 build as long as libc6-compat is installed.
Development
This project requires Go 1.26 and Terraform 1.15.0.
This project uses Go Modules for dependency management, which allows this project to exist outside an existing GOPATH.
After cloning the repository, you can build the project by running make build.
Debugging
We support remote debugging via delve via the make target build-debug and run-debug.
To debug the plugin, proceed as follows:
Run make build-debug
Run make run-debug
Attach a remote debugger to the printed local address, e.g. 127.0.0.1:58772 from your IDE.
Copy the TF_REATTACH_PROVIDERS='{...}' env variable, that is printed by the delve debugger after attachment.
In a separate terminal prepend the TF_REATTACH_PROVIDERS='{...}' env variable to your terraform ... command
Note that we use the delve options to wait for a debugger. This allows us to debug the complete
plugin lifecycle.
Note for Goland users, there is a preconfigured remote debugger configuration called local debug.
Debugging Example
The easiest way to play with the remote debugger setup is the bundled example project.
To use that run make build-example-debug and follow the steps above.
Local Environment
You can spin up a local developer environment via Docker Compose by running make local.
This will spin up a few containers for Keycloak, PostgreSQL, and OpenLDAP, which can be used for testing the provider.
This environment and its setup via make local is not intended for production use.
You can also use make local-mtls to start Keycloak with required client authentication via mTLS certificate.
To stop the environment you can use the make local-stop. To remove the local environment use make local-down.
Note: The setup scripts require the jq command line utility.
Tests
Every resource supported by this provider will have a reasonable amount of acceptance test coverage.
You can run acceptance tests against a Keycloak instance by running make testacc. You will need to supply some environment
variables in order to set up the provider during tests. Here is an example for running tests against a local environment
that was created via make local:
You can also run the same tests on Keycloak's https port with the Keycloak Terraform provider authenticating to the server with a mTLS client certificate.
For this start the env with make local-mtls. After that run the following command:
You can also run the same test with a provided access token.
For this start the env with make local. To obtain an access token for the admin user via the admin-cli client, run make access-token to
store an acess token in the ./keycloak_access_token file.
After that run the following command:
make access-token
KEYCLOAK_CLIENT_ID=terraform \
KEYCLOAK_CLIENT_TIMEOUT=5 \
KEYCLOAK_ACCESS_TOKEN="$(cat keycloak_access_token)" \
KEYCLOAK_REALM=master \
KEYCLOAK_URL="http://localhost:8080" \
make testauth
Resources that live in a realm
A realm can be renamed (see Renaming a realm), and its internal id stays the same.
Every resource and data source with a required realm_id (or realm) argument automatically gets a realm_internal_id argument
as well. provider/realm_reference.go adds it to the whole provider, so a new resource needs no code for it. The provider
resolves realm_internal_id to the current realm name before it calls your create, read, update or delete function. To keep
renames working in a new resource:
Use data.Get("realm_id") (or realm) to get the realm in create, read, update and delete. It always holds the current
realm name. Do not take the realm from data.Id(), and do not split it out of a composite id: such an id keeps the name the
realm had when the resource was created. Parsing the id in an import function is fine.
If the id of the resource is the realm name (as for keycloak_realm_events), register the resource in
resourceRealmIDFormats in provider/realm_reference.go with realmNameID, so that its id follows a rename.
If the id contains the realm name as its first part (<realm>/<something>), register the resource in
resourceRealmIDFormats with realmPrefixedID, take the realm from realm_id and only the other parts from the id.
The id is then updated after a rename.
A resource that is not registered there is treated as opaqueID: its id is never rewritten, so a realm name in it
would keep the old name after a rename.
Add the resource to TestAccKeycloakRealm_renameWithMixedChildren in
provider/resource_keycloak_realm_rename_test.go, using realm_internal_id, and check that it is not replaced by a rename.
TestRealmInternalIdIsOnEveryRealmScopedResource fails for a resource without a realm argument. If the resource is not
scoped to a realm, add it to that test's exceptions.
Run examples
You can run examples against a Keycloak instance.
Follow the commands for running examples against a local environment that was created via make local:
make build-example
cd example
terraform init
terraform plan -out tfplan
terraform apply tfplan
rm tfplan
Acknowledgments
The Keycloak Terraform Provider was originally created by Michael Parker. Many thanks for the hard work and dedication in building the foundation for this project.
Also, many thanks to all the contributors extending it and approving the license change to maintain it as part of the Keycloak project.
License
This software is licensed under Apache License, Version 2.0, (LICENSE-APACHE-2.0 or https://www.apache.org/licenses/LICENSE-2.0)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this software by you shall be licensed under the Apache License, Version 2.0, without any additional terms or conditions.
How active is development on keycloak/terraform-provider-keycloak?
The most recent commit recorded on keycloak/terraform-provider-keycloak was 7 days ago, based on the GitHub push timestamp. The repository has 462 forks — one of the better signals of community interest.
How does keycloak/terraform-provider-keycloak compare to other Developer Tools projects?
keycloak/terraform-provider-keycloak is tracked by TopGit in the Developer Tools category, with 960 GitHub stars and written in Go. Browse the Developer Tools topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does keycloak/terraform-provider-keycloak have?
keycloak/terraform-provider-keycloak has 960 GitHub stars — refresh the page for the live number, or check github.com/keycloak/terraform-provider-keycloak. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is keycloak/terraform-provider-keycloak open source?
Yes — keycloak/terraform-provider-keycloak ships under the Apache-2.0 license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/keycloak/terraform-provider-keycloak.
What is keycloak/terraform-provider-keycloak?
keycloak/terraform-provider-keycloak (keycloak/terraform-provider-keycloak) is a Go project on GitHub. From the project's own README: Terraform provider for Keycloak
Where do I read more about keycloak/terraform-provider-keycloak?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/keycloak/terraform-provider-keycloak is the definitive source.
Read full README in the tab above.
Curious whether terraform-provider-keycloak is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about terraform-provider-keycloak.