1. Packages
  2. Keycloak Provider
  3. API Docs
  4. RealmKeystoreHmacGenerated
Keycloak v6.2.2 published on Wednesday, Apr 9, 2025 by Pulumi

keycloak.RealmKeystoreHmacGenerated

Explore with Pulumi AI

Allows for creating and managing hmac-generated Realm keystores within Keycloak.

A realm keystore manages generated key pairs that are used by Keycloak to perform cryptographic signatures and encryption.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";

const realm = new keycloak.Realm("realm", {realm: "my-realm"});
const keystoreHmacGenerated = new keycloak.RealmKeystoreHmacGenerated("keystore_hmac_generated", {
    name: "my-hmac-generated-key",
    realmId: realm.id,
    enabled: true,
    active: true,
    priority: 100,
    algorithm: "HS256",
    secretSize: 64,
});
Copy
import pulumi
import pulumi_keycloak as keycloak

realm = keycloak.Realm("realm", realm="my-realm")
keystore_hmac_generated = keycloak.RealmKeystoreHmacGenerated("keystore_hmac_generated",
    name="my-hmac-generated-key",
    realm_id=realm.id,
    enabled=True,
    active=True,
    priority=100,
    algorithm="HS256",
    secret_size=64)
Copy
package main

import (
	"github.com/pulumi/pulumi-keycloak/sdk/v6/go/keycloak"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		realm, err := keycloak.NewRealm(ctx, "realm", &keycloak.RealmArgs{
			Realm: pulumi.String("my-realm"),
		})
		if err != nil {
			return err
		}
		_, err = keycloak.NewRealmKeystoreHmacGenerated(ctx, "keystore_hmac_generated", &keycloak.RealmKeystoreHmacGeneratedArgs{
			Name:       pulumi.String("my-hmac-generated-key"),
			RealmId:    realm.ID(),
			Enabled:    pulumi.Bool(true),
			Active:     pulumi.Bool(true),
			Priority:   pulumi.Int(100),
			Algorithm:  pulumi.String("HS256"),
			SecretSize: pulumi.Int(64),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Keycloak = Pulumi.Keycloak;

return await Deployment.RunAsync(() => 
{
    var realm = new Keycloak.Realm("realm", new()
    {
        RealmName = "my-realm",
    });

    var keystoreHmacGenerated = new Keycloak.RealmKeystoreHmacGenerated("keystore_hmac_generated", new()
    {
        Name = "my-hmac-generated-key",
        RealmId = realm.Id,
        Enabled = true,
        Active = true,
        Priority = 100,
        Algorithm = "HS256",
        SecretSize = 64,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.keycloak.Realm;
import com.pulumi.keycloak.RealmArgs;
import com.pulumi.keycloak.RealmKeystoreHmacGenerated;
import com.pulumi.keycloak.RealmKeystoreHmacGeneratedArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var realm = new Realm("realm", RealmArgs.builder()
            .realm("my-realm")
            .build());

        var keystoreHmacGenerated = new RealmKeystoreHmacGenerated("keystoreHmacGenerated", RealmKeystoreHmacGeneratedArgs.builder()
            .name("my-hmac-generated-key")
            .realmId(realm.id())
            .enabled(true)
            .active(true)
            .priority(100)
            .algorithm("HS256")
            .secretSize(64)
            .build());

    }
}
Copy
resources:
  realm:
    type: keycloak:Realm
    properties:
      realm: my-realm
  keystoreHmacGenerated:
    type: keycloak:RealmKeystoreHmacGenerated
    name: keystore_hmac_generated
    properties:
      name: my-hmac-generated-key
      realmId: ${realm.id}
      enabled: true
      active: true
      priority: 100
      algorithm: HS256
      secretSize: 64
Copy

Create RealmKeystoreHmacGenerated Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RealmKeystoreHmacGenerated(name: string, args: RealmKeystoreHmacGeneratedArgs, opts?: CustomResourceOptions);
@overload
def RealmKeystoreHmacGenerated(resource_name: str,
                               args: RealmKeystoreHmacGeneratedArgs,
                               opts: Optional[ResourceOptions] = None)

@overload
def RealmKeystoreHmacGenerated(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               realm_id: Optional[str] = None,
                               active: Optional[bool] = None,
                               algorithm: Optional[str] = None,
                               enabled: Optional[bool] = None,
                               name: Optional[str] = None,
                               priority: Optional[int] = None,
                               secret_size: Optional[int] = None)
func NewRealmKeystoreHmacGenerated(ctx *Context, name string, args RealmKeystoreHmacGeneratedArgs, opts ...ResourceOption) (*RealmKeystoreHmacGenerated, error)
public RealmKeystoreHmacGenerated(string name, RealmKeystoreHmacGeneratedArgs args, CustomResourceOptions? opts = null)
public RealmKeystoreHmacGenerated(String name, RealmKeystoreHmacGeneratedArgs args)
public RealmKeystoreHmacGenerated(String name, RealmKeystoreHmacGeneratedArgs args, CustomResourceOptions options)
type: keycloak:RealmKeystoreHmacGenerated
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RealmKeystoreHmacGeneratedArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RealmKeystoreHmacGeneratedArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RealmKeystoreHmacGeneratedArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RealmKeystoreHmacGeneratedArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RealmKeystoreHmacGeneratedArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var realmKeystoreHmacGeneratedResource = new Keycloak.RealmKeystoreHmacGenerated("realmKeystoreHmacGeneratedResource", new()
{
    RealmId = "string",
    Active = false,
    Algorithm = "string",
    Enabled = false,
    Name = "string",
    Priority = 0,
    SecretSize = 0,
});
Copy
example, err := keycloak.NewRealmKeystoreHmacGenerated(ctx, "realmKeystoreHmacGeneratedResource", &keycloak.RealmKeystoreHmacGeneratedArgs{
	RealmId:    pulumi.String("string"),
	Active:     pulumi.Bool(false),
	Algorithm:  pulumi.String("string"),
	Enabled:    pulumi.Bool(false),
	Name:       pulumi.String("string"),
	Priority:   pulumi.Int(0),
	SecretSize: pulumi.Int(0),
})
Copy
var realmKeystoreHmacGeneratedResource = new RealmKeystoreHmacGenerated("realmKeystoreHmacGeneratedResource", RealmKeystoreHmacGeneratedArgs.builder()
    .realmId("string")
    .active(false)
    .algorithm("string")
    .enabled(false)
    .name("string")
    .priority(0)
    .secretSize(0)
    .build());
Copy
realm_keystore_hmac_generated_resource = keycloak.RealmKeystoreHmacGenerated("realmKeystoreHmacGeneratedResource",
    realm_id="string",
    active=False,
    algorithm="string",
    enabled=False,
    name="string",
    priority=0,
    secret_size=0)
Copy
const realmKeystoreHmacGeneratedResource = new keycloak.RealmKeystoreHmacGenerated("realmKeystoreHmacGeneratedResource", {
    realmId: "string",
    active: false,
    algorithm: "string",
    enabled: false,
    name: "string",
    priority: 0,
    secretSize: 0,
});
Copy
type: keycloak:RealmKeystoreHmacGenerated
properties:
    active: false
    algorithm: string
    enabled: false
    name: string
    priority: 0
    realmId: string
    secretSize: 0
Copy

RealmKeystoreHmacGenerated Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RealmKeystoreHmacGenerated resource accepts the following input properties:

RealmId
This property is required.
Changes to this property will trigger replacement.
string
The realm this keystore exists in.
Active bool
When false, key in not used for signing. Defaults to true.
Algorithm string
Intended algorithm for the key. Defaults to HS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
Name string
Display name of provider when linked in admin console.
Priority int
Priority for the provider. Defaults to 0
SecretSize int
Size in bytes for the generated secret. Defaults to 64.
RealmId
This property is required.
Changes to this property will trigger replacement.
string
The realm this keystore exists in.
Active bool
When false, key in not used for signing. Defaults to true.
Algorithm string
Intended algorithm for the key. Defaults to HS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
Name string
Display name of provider when linked in admin console.
Priority int
Priority for the provider. Defaults to 0
SecretSize int
Size in bytes for the generated secret. Defaults to 64.
realmId
This property is required.
Changes to this property will trigger replacement.
String
The realm this keystore exists in.
active Boolean
When false, key in not used for signing. Defaults to true.
algorithm String
Intended algorithm for the key. Defaults to HS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
name String
Display name of provider when linked in admin console.
priority Integer
Priority for the provider. Defaults to 0
secretSize Integer
Size in bytes for the generated secret. Defaults to 64.
realmId
This property is required.
Changes to this property will trigger replacement.
string
The realm this keystore exists in.
active boolean
When false, key in not used for signing. Defaults to true.
algorithm string
Intended algorithm for the key. Defaults to HS256
enabled boolean
When false, key is not accessible in this realm. Defaults to true.
name string
Display name of provider when linked in admin console.
priority number
Priority for the provider. Defaults to 0
secretSize number
Size in bytes for the generated secret. Defaults to 64.
realm_id
This property is required.
Changes to this property will trigger replacement.
str
The realm this keystore exists in.
active bool
When false, key in not used for signing. Defaults to true.
algorithm str
Intended algorithm for the key. Defaults to HS256
enabled bool
When false, key is not accessible in this realm. Defaults to true.
name str
Display name of provider when linked in admin console.
priority int
Priority for the provider. Defaults to 0
secret_size int
Size in bytes for the generated secret. Defaults to 64.
realmId
This property is required.
Changes to this property will trigger replacement.
String
The realm this keystore exists in.
active Boolean
When false, key in not used for signing. Defaults to true.
algorithm String
Intended algorithm for the key. Defaults to HS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
name String
Display name of provider when linked in admin console.
priority Number
Priority for the provider. Defaults to 0
secretSize Number
Size in bytes for the generated secret. Defaults to 64.

Outputs

All input properties are implicitly available as output properties. Additionally, the RealmKeystoreHmacGenerated resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RealmKeystoreHmacGenerated Resource

Get an existing RealmKeystoreHmacGenerated resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RealmKeystoreHmacGeneratedState, opts?: CustomResourceOptions): RealmKeystoreHmacGenerated
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        active: Optional[bool] = None,
        algorithm: Optional[str] = None,
        enabled: Optional[bool] = None,
        name: Optional[str] = None,
        priority: Optional[int] = None,
        realm_id: Optional[str] = None,
        secret_size: Optional[int] = None) -> RealmKeystoreHmacGenerated
func GetRealmKeystoreHmacGenerated(ctx *Context, name string, id IDInput, state *RealmKeystoreHmacGeneratedState, opts ...ResourceOption) (*RealmKeystoreHmacGenerated, error)
public static RealmKeystoreHmacGenerated Get(string name, Input<string> id, RealmKeystoreHmacGeneratedState? state, CustomResourceOptions? opts = null)
public static RealmKeystoreHmacGenerated get(String name, Output<String> id, RealmKeystoreHmacGeneratedState state, CustomResourceOptions options)
resources:  _:    type: keycloak:RealmKeystoreHmacGenerated    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Active bool
When false, key in not used for signing. Defaults to true.
Algorithm string
Intended algorithm for the key. Defaults to HS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
Name string
Display name of provider when linked in admin console.
Priority int
Priority for the provider. Defaults to 0
RealmId Changes to this property will trigger replacement. string
The realm this keystore exists in.
SecretSize int
Size in bytes for the generated secret. Defaults to 64.
Active bool
When false, key in not used for signing. Defaults to true.
Algorithm string
Intended algorithm for the key. Defaults to HS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
Name string
Display name of provider when linked in admin console.
Priority int
Priority for the provider. Defaults to 0
RealmId Changes to this property will trigger replacement. string
The realm this keystore exists in.
SecretSize int
Size in bytes for the generated secret. Defaults to 64.
active Boolean
When false, key in not used for signing. Defaults to true.
algorithm String
Intended algorithm for the key. Defaults to HS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
name String
Display name of provider when linked in admin console.
priority Integer
Priority for the provider. Defaults to 0
realmId Changes to this property will trigger replacement. String
The realm this keystore exists in.
secretSize Integer
Size in bytes for the generated secret. Defaults to 64.
active boolean
When false, key in not used for signing. Defaults to true.
algorithm string
Intended algorithm for the key. Defaults to HS256
enabled boolean
When false, key is not accessible in this realm. Defaults to true.
name string
Display name of provider when linked in admin console.
priority number
Priority for the provider. Defaults to 0
realmId Changes to this property will trigger replacement. string
The realm this keystore exists in.
secretSize number
Size in bytes for the generated secret. Defaults to 64.
active bool
When false, key in not used for signing. Defaults to true.
algorithm str
Intended algorithm for the key. Defaults to HS256
enabled bool
When false, key is not accessible in this realm. Defaults to true.
name str
Display name of provider when linked in admin console.
priority int
Priority for the provider. Defaults to 0
realm_id Changes to this property will trigger replacement. str
The realm this keystore exists in.
secret_size int
Size in bytes for the generated secret. Defaults to 64.
active Boolean
When false, key in not used for signing. Defaults to true.
algorithm String
Intended algorithm for the key. Defaults to HS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
name String
Display name of provider when linked in admin console.
priority Number
Priority for the provider. Defaults to 0
realmId Changes to this property will trigger replacement. String
The realm this keystore exists in.
secretSize Number
Size in bytes for the generated secret. Defaults to 64.

Import

Realm keys can be imported using realm name and keystore id, you can find it in web UI.

Example:

bash

$ pulumi import keycloak:index/realmKeystoreHmacGenerated:RealmKeystoreHmacGenerated keystore_hmac_generated my-realm/618cfba7-49aa-4c09-9a19-2f699b576f0b
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Keycloak pulumi/pulumi-keycloak
License
Apache-2.0
Notes
This Pulumi package is based on the keycloak Terraform Provider.