1. Packages
  2. Keycloak Provider
  3. API Docs
  4. RealmKeystoreRsaGenerated
Keycloak v6.4.0 published on Wednesday, Apr 16, 2025 by Pulumi

keycloak.RealmKeystoreRsaGenerated

Explore with Pulumi AI

Allows for creating and managing rsa-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 keystoreRsaGenerated = new keycloak.RealmKeystoreRsaGenerated("keystore_rsa_generated", {
    name: "my-rsa-generated-key",
    realmId: realm.id,
    enabled: true,
    active: true,
    priority: 100,
    algorithm: "RS256",
    keySize: 2048,
});
Copy
import pulumi
import pulumi_keycloak as keycloak

realm = keycloak.Realm("realm", realm="my-realm")
keystore_rsa_generated = keycloak.RealmKeystoreRsaGenerated("keystore_rsa_generated",
    name="my-rsa-generated-key",
    realm_id=realm.id,
    enabled=True,
    active=True,
    priority=100,
    algorithm="RS256",
    key_size=2048)
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.NewRealmKeystoreRsaGenerated(ctx, "keystore_rsa_generated", &keycloak.RealmKeystoreRsaGeneratedArgs{
			Name:      pulumi.String("my-rsa-generated-key"),
			RealmId:   realm.ID(),
			Enabled:   pulumi.Bool(true),
			Active:    pulumi.Bool(true),
			Priority:  pulumi.Int(100),
			Algorithm: pulumi.String("RS256"),
			KeySize:   pulumi.Int(2048),
		})
		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 keystoreRsaGenerated = new Keycloak.RealmKeystoreRsaGenerated("keystore_rsa_generated", new()
    {
        Name = "my-rsa-generated-key",
        RealmId = realm.Id,
        Enabled = true,
        Active = true,
        Priority = 100,
        Algorithm = "RS256",
        KeySize = 2048,
    });

});
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.RealmKeystoreRsaGenerated;
import com.pulumi.keycloak.RealmKeystoreRsaGeneratedArgs;
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 keystoreRsaGenerated = new RealmKeystoreRsaGenerated("keystoreRsaGenerated", RealmKeystoreRsaGeneratedArgs.builder()
            .name("my-rsa-generated-key")
            .realmId(realm.id())
            .enabled(true)
            .active(true)
            .priority(100)
            .algorithm("RS256")
            .keySize(2048)
            .build());

    }
}
Copy
resources:
  realm:
    type: keycloak:Realm
    properties:
      realm: my-realm
  keystoreRsaGenerated:
    type: keycloak:RealmKeystoreRsaGenerated
    name: keystore_rsa_generated
    properties:
      name: my-rsa-generated-key
      realmId: ${realm.id}
      enabled: true
      active: true
      priority: 100
      algorithm: RS256
      keySize: 2048
Copy

Create RealmKeystoreRsaGenerated Resource

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

Constructor syntax

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

@overload
def RealmKeystoreRsaGenerated(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              realm_id: Optional[str] = None,
                              active: Optional[bool] = None,
                              algorithm: Optional[str] = None,
                              enabled: Optional[bool] = None,
                              key_size: Optional[int] = None,
                              name: Optional[str] = None,
                              priority: Optional[int] = None)
func NewRealmKeystoreRsaGenerated(ctx *Context, name string, args RealmKeystoreRsaGeneratedArgs, opts ...ResourceOption) (*RealmKeystoreRsaGenerated, error)
public RealmKeystoreRsaGenerated(string name, RealmKeystoreRsaGeneratedArgs args, CustomResourceOptions? opts = null)
public RealmKeystoreRsaGenerated(String name, RealmKeystoreRsaGeneratedArgs args)
public RealmKeystoreRsaGenerated(String name, RealmKeystoreRsaGeneratedArgs args, CustomResourceOptions options)
type: keycloak:RealmKeystoreRsaGenerated
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. RealmKeystoreRsaGeneratedArgs
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. RealmKeystoreRsaGeneratedArgs
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. RealmKeystoreRsaGeneratedArgs
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. RealmKeystoreRsaGeneratedArgs
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. RealmKeystoreRsaGeneratedArgs
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 realmKeystoreRsaGeneratedResource = new Keycloak.RealmKeystoreRsaGenerated("realmKeystoreRsaGeneratedResource", new()
{
    RealmId = "string",
    Active = false,
    Algorithm = "string",
    Enabled = false,
    KeySize = 0,
    Name = "string",
    Priority = 0,
});
Copy
example, err := keycloak.NewRealmKeystoreRsaGenerated(ctx, "realmKeystoreRsaGeneratedResource", &keycloak.RealmKeystoreRsaGeneratedArgs{
	RealmId:   pulumi.String("string"),
	Active:    pulumi.Bool(false),
	Algorithm: pulumi.String("string"),
	Enabled:   pulumi.Bool(false),
	KeySize:   pulumi.Int(0),
	Name:      pulumi.String("string"),
	Priority:  pulumi.Int(0),
})
Copy
var realmKeystoreRsaGeneratedResource = new RealmKeystoreRsaGenerated("realmKeystoreRsaGeneratedResource", RealmKeystoreRsaGeneratedArgs.builder()
    .realmId("string")
    .active(false)
    .algorithm("string")
    .enabled(false)
    .keySize(0)
    .name("string")
    .priority(0)
    .build());
Copy
realm_keystore_rsa_generated_resource = keycloak.RealmKeystoreRsaGenerated("realmKeystoreRsaGeneratedResource",
    realm_id="string",
    active=False,
    algorithm="string",
    enabled=False,
    key_size=0,
    name="string",
    priority=0)
Copy
const realmKeystoreRsaGeneratedResource = new keycloak.RealmKeystoreRsaGenerated("realmKeystoreRsaGeneratedResource", {
    realmId: "string",
    active: false,
    algorithm: "string",
    enabled: false,
    keySize: 0,
    name: "string",
    priority: 0,
});
Copy
type: keycloak:RealmKeystoreRsaGenerated
properties:
    active: false
    algorithm: string
    enabled: false
    keySize: 0
    name: string
    priority: 0
    realmId: string
Copy

RealmKeystoreRsaGenerated 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 RealmKeystoreRsaGenerated 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 RS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
KeySize int
Size for the generated keys. Defaults to 2048.
Name string
Display name of provider when linked in admin console.
Priority int
Priority for the provider. Defaults to 0
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 RS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
KeySize int
Size for the generated keys. Defaults to 2048.
Name string
Display name of provider when linked in admin console.
Priority int
Priority for the provider. Defaults to 0
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 RS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
keySize Integer
Size for the generated keys. Defaults to 2048.
name String
Display name of provider when linked in admin console.
priority Integer
Priority for the provider. Defaults to 0
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 RS256
enabled boolean
When false, key is not accessible in this realm. Defaults to true.
keySize number
Size for the generated keys. Defaults to 2048.
name string
Display name of provider when linked in admin console.
priority number
Priority for the provider. Defaults to 0
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 RS256
enabled bool
When false, key is not accessible in this realm. Defaults to true.
key_size int
Size for the generated keys. Defaults to 2048.
name str
Display name of provider when linked in admin console.
priority int
Priority for the provider. Defaults to 0
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 RS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
keySize Number
Size for the generated keys. Defaults to 2048.
name String
Display name of provider when linked in admin console.
priority Number
Priority for the provider. Defaults to 0

Outputs

All input properties are implicitly available as output properties. Additionally, the RealmKeystoreRsaGenerated 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 RealmKeystoreRsaGenerated Resource

Get an existing RealmKeystoreRsaGenerated 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?: RealmKeystoreRsaGeneratedState, opts?: CustomResourceOptions): RealmKeystoreRsaGenerated
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        active: Optional[bool] = None,
        algorithm: Optional[str] = None,
        enabled: Optional[bool] = None,
        key_size: Optional[int] = None,
        name: Optional[str] = None,
        priority: Optional[int] = None,
        realm_id: Optional[str] = None) -> RealmKeystoreRsaGenerated
func GetRealmKeystoreRsaGenerated(ctx *Context, name string, id IDInput, state *RealmKeystoreRsaGeneratedState, opts ...ResourceOption) (*RealmKeystoreRsaGenerated, error)
public static RealmKeystoreRsaGenerated Get(string name, Input<string> id, RealmKeystoreRsaGeneratedState? state, CustomResourceOptions? opts = null)
public static RealmKeystoreRsaGenerated get(String name, Output<String> id, RealmKeystoreRsaGeneratedState state, CustomResourceOptions options)
resources:  _:    type: keycloak:RealmKeystoreRsaGenerated    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 RS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
KeySize int
Size for the generated keys. Defaults to 2048.
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.
Active bool
When false, key in not used for signing. Defaults to true.
Algorithm string
Intended algorithm for the key. Defaults to RS256
Enabled bool
When false, key is not accessible in this realm. Defaults to true.
KeySize int
Size for the generated keys. Defaults to 2048.
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.
active Boolean
When false, key in not used for signing. Defaults to true.
algorithm String
Intended algorithm for the key. Defaults to RS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
keySize Integer
Size for the generated keys. Defaults to 2048.
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.
active boolean
When false, key in not used for signing. Defaults to true.
algorithm string
Intended algorithm for the key. Defaults to RS256
enabled boolean
When false, key is not accessible in this realm. Defaults to true.
keySize number
Size for the generated keys. Defaults to 2048.
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.
active bool
When false, key in not used for signing. Defaults to true.
algorithm str
Intended algorithm for the key. Defaults to RS256
enabled bool
When false, key is not accessible in this realm. Defaults to true.
key_size int
Size for the generated keys. Defaults to 2048.
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.
active Boolean
When false, key in not used for signing. Defaults to true.
algorithm String
Intended algorithm for the key. Defaults to RS256
enabled Boolean
When false, key is not accessible in this realm. Defaults to true.
keySize Number
Size for the generated keys. Defaults to 2048.
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.

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/realmKeystoreRsaGenerated:RealmKeystoreRsaGenerated keystore_rsa_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.