/keycloak-vault

This is an example Terraform implementation of a Keycloak Vault integration.

Primary LanguageHCLApache License 2.0Apache-2.0

Integrate Keycloak with HashiCorp Vault

This is an example Terraform implementation of a Keycloak Vault integration.
The project refers to a medium post on this topic.

This version is compatible with Quarkus, for Keyloak on Wildfly see here

Prerequisite

Keycloak frontend name resolution

You need to set the following entry in /etc/hosts or C:\Windows\System32\drivers\etc\hosts.

127.0.0.1 keycloak

This change should be done on the operating system that the end-user's browser is running on (when using WSL the change needs to be done on windows system).

The keycloak name resolution for the backend (vault->keycloak) is done through the docker service name.

Make

Install make. Ex for debian-like systems:

sudo apt install make

Alternatively check the Makefile and manually run the commands.

For example to run the stack in the foreground and display all logs in the standard output, instead of make up you can use:

docker-compose up

Usage

Use makefile:
make [help | up | down | init | provision | deprovision | destroy | shell]

  1. Start the local environment (Docker) make up
  2. Initialize Terraform make init
  3. Apply the Terraform configuration make provision
  4. Shutdown the local environment (Docker) make down

Makefile

Command Description
up start docker container
down stop docker container
init terraform init
provision terraform apply
deprovision terraform destroy
destroy terraform destroy and remove all terraform related files/states
shell open a shell with terraform binary