Skip to content

OpenID Connect - OpenTofu setup ​

OpenTofu is an open-source IaC (Infrastructure as Code) tool, forked from Terraform.

This guide will show how to automatically create the OpenID client on common OpenID Connect providers.

It will use OpenTofu but should also work with Terraform.

IMPORTANT

This example assumes you have your OpenID Connect provider up and running.

You also need to have OpenTofu properly setup, you can follow the official guide.

Keycloak ​

Keycloak provides an official OpenTofu/Terraform provider:

You can follow official instructions to properly connect OpenTofu to Keycloak:

oktomusic.tf
terraform
terraform {
  required_providers {
    keycloak = {
      source = "keycloak/keycloak"
      version = "5.7.0"
    }
  }
}

provider "keycloak" {
  # Authentication options
}