1. Packages
  2. Keycloak
  3. API Docs
  4. Role
Keycloak v5.2.1 published on Tuesday, Jun 27, 2023 by Pulumi

keycloak.Role

Explore with Pulumi AI

keycloak logo
Keycloak v5.2.1 published on Tuesday, Jun 27, 2023 by Pulumi

    Allows for creating and managing roles within Keycloak.

    Roles allow you define privileges within Keycloak and map them to users and groups.

    Example Usage

    Realm Role)

    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",
            Enabled = true,
        });
    
        var realmRole = new Keycloak.Role("realmRole", new()
        {
            RealmId = realm.Id,
            Description = "My Realm Role",
            Attributes = 
            {
                { "key", "value" },
                { "multivalue", "value1##value2" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/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"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keycloak.NewRole(ctx, "realmRole", &keycloak.RoleArgs{
    			RealmId:     realm.ID(),
    			Description: pulumi.String("My Realm Role"),
    			Attributes: pulumi.AnyMap{
    				"key":        pulumi.Any("value"),
    				"multivalue": pulumi.Any("value1##value2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.Role;
    import com.pulumi.keycloak.RoleArgs;
    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")
                .enabled(true)
                .build());
    
            var realmRole = new Role("realmRole", RoleArgs.builder()        
                .realmId(realm.id())
                .description("My Realm Role")
                .attributes(Map.ofEntries(
                    Map.entry("key", "value"),
                    Map.entry("multivalue", "value1##value2")
                ))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        realm="my-realm",
        enabled=True)
    realm_role = keycloak.Role("realmRole",
        realm_id=realm.id,
        description="My Realm Role",
        attributes={
            "key": "value",
            "multivalue": "value1##value2",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    
    const realm = new keycloak.Realm("realm", {
        realm: "my-realm",
        enabled: true,
    });
    const realmRole = new keycloak.Role("realmRole", {
        realmId: realm.id,
        description: "My Realm Role",
        attributes: {
            key: "value",
            multivalue: "value1##value2",
        },
    });
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          realm: my-realm
          enabled: true
      realmRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          description: My Realm Role
          attributes:
            key: value
            multivalue: value1##value2
    

    Client Role)

    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",
            Enabled = true,
        });
    
        var openidClient = new Keycloak.OpenId.Client("openidClient", new()
        {
            RealmId = realm.Id,
            ClientId = "client",
            Enabled = true,
            AccessType = "CONFIDENTIAL",
            ValidRedirectUris = new[]
            {
                "http://localhost:8080/openid-callback",
            },
        });
    
        var clientRole = new Keycloak.Role("clientRole", new()
        {
            RealmId = realm.Id,
            ClientId = keycloak_client.Openid_client.Id,
            Description = "My Client Role",
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/openid"
    	"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"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = openid.NewClient(ctx, "openidClient", &openid.ClientArgs{
    			RealmId:    realm.ID(),
    			ClientId:   pulumi.String("client"),
    			Enabled:    pulumi.Bool(true),
    			AccessType: pulumi.String("CONFIDENTIAL"),
    			ValidRedirectUris: pulumi.StringArray{
    				pulumi.String("http://localhost:8080/openid-callback"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keycloak.NewRole(ctx, "clientRole", &keycloak.RoleArgs{
    			RealmId:     realm.ID(),
    			ClientId:    pulumi.Any(keycloak_client.Openid_client.Id),
    			Description: pulumi.String("My Client Role"),
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.openid.Client;
    import com.pulumi.keycloak.openid.ClientArgs;
    import com.pulumi.keycloak.Role;
    import com.pulumi.keycloak.RoleArgs;
    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")
                .enabled(true)
                .build());
    
            var openidClient = new Client("openidClient", ClientArgs.builder()        
                .realmId(realm.id())
                .clientId("client")
                .enabled(true)
                .accessType("CONFIDENTIAL")
                .validRedirectUris("http://localhost:8080/openid-callback")
                .build());
    
            var clientRole = new Role("clientRole", RoleArgs.builder()        
                .realmId(realm.id())
                .clientId(keycloak_client.openid_client().id())
                .description("My Client Role")
                .attributes(Map.of("key", "value"))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        realm="my-realm",
        enabled=True)
    openid_client = keycloak.openid.Client("openidClient",
        realm_id=realm.id,
        client_id="client",
        enabled=True,
        access_type="CONFIDENTIAL",
        valid_redirect_uris=["http://localhost:8080/openid-callback"])
    client_role = keycloak.Role("clientRole",
        realm_id=realm.id,
        client_id=keycloak_client["openid_client"]["id"],
        description="My Client Role",
        attributes={
            "key": "value",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    
    const realm = new keycloak.Realm("realm", {
        realm: "my-realm",
        enabled: true,
    });
    const openidClient = new keycloak.openid.Client("openidClient", {
        realmId: realm.id,
        clientId: "client",
        enabled: true,
        accessType: "CONFIDENTIAL",
        validRedirectUris: ["http://localhost:8080/openid-callback"],
    });
    const clientRole = new keycloak.Role("clientRole", {
        realmId: realm.id,
        clientId: keycloak_client.openid_client.id,
        description: "My Client Role",
        attributes: {
            key: "value",
        },
    });
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          realm: my-realm
          enabled: true
      openidClient:
        type: keycloak:openid:Client
        properties:
          realmId: ${realm.id}
          clientId: client
          enabled: true
          accessType: CONFIDENTIAL
          validRedirectUris:
            - http://localhost:8080/openid-callback
      clientRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          clientId: ${keycloak_client.openid_client.id}
          description: My Client Role
          attributes:
            key: value
    

    Composite Role)

    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",
            Enabled = true,
        });
    
        // realm roles
        var createRole = new Keycloak.Role("createRole", new()
        {
            RealmId = realm.Id,
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
        var readRole = new Keycloak.Role("readRole", new()
        {
            RealmId = realm.Id,
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
        var updateRole = new Keycloak.Role("updateRole", new()
        {
            RealmId = realm.Id,
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
        var deleteRole = new Keycloak.Role("deleteRole", new()
        {
            RealmId = realm.Id,
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
        // client role
        var openidClient = new Keycloak.OpenId.Client("openidClient", new()
        {
            RealmId = realm.Id,
            ClientId = "client",
            Enabled = true,
            AccessType = "CONFIDENTIAL",
            ValidRedirectUris = new[]
            {
                "http://localhost:8080/openid-callback",
            },
        });
    
        var clientRole = new Keycloak.Role("clientRole", new()
        {
            RealmId = realm.Id,
            ClientId = keycloak_client.Openid_client.Id,
            Description = "My Client Role",
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
        var adminRole = new Keycloak.Role("adminRole", new()
        {
            RealmId = realm.Id,
            CompositeRoles = new[]
            {
                createRole.Id,
                readRole.Id,
                updateRole.Id,
                deleteRole.Id,
                clientRole.Id,
            },
            Attributes = 
            {
                { "key", "value" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/openid"
    	"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"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		createRole, err := keycloak.NewRole(ctx, "createRole", &keycloak.RoleArgs{
    			RealmId: realm.ID(),
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		readRole, err := keycloak.NewRole(ctx, "readRole", &keycloak.RoleArgs{
    			RealmId: realm.ID(),
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		updateRole, err := keycloak.NewRole(ctx, "updateRole", &keycloak.RoleArgs{
    			RealmId: realm.ID(),
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		deleteRole, err := keycloak.NewRole(ctx, "deleteRole", &keycloak.RoleArgs{
    			RealmId: realm.ID(),
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = openid.NewClient(ctx, "openidClient", &openid.ClientArgs{
    			RealmId:    realm.ID(),
    			ClientId:   pulumi.String("client"),
    			Enabled:    pulumi.Bool(true),
    			AccessType: pulumi.String("CONFIDENTIAL"),
    			ValidRedirectUris: pulumi.StringArray{
    				pulumi.String("http://localhost:8080/openid-callback"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		clientRole, err := keycloak.NewRole(ctx, "clientRole", &keycloak.RoleArgs{
    			RealmId:     realm.ID(),
    			ClientId:    pulumi.Any(keycloak_client.Openid_client.Id),
    			Description: pulumi.String("My Client Role"),
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keycloak.NewRole(ctx, "adminRole", &keycloak.RoleArgs{
    			RealmId: realm.ID(),
    			CompositeRoles: pulumi.StringArray{
    				createRole.ID(),
    				readRole.ID(),
    				updateRole.ID(),
    				deleteRole.ID(),
    				clientRole.ID(),
    			},
    			Attributes: pulumi.AnyMap{
    				"key": pulumi.Any("value"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.Role;
    import com.pulumi.keycloak.RoleArgs;
    import com.pulumi.keycloak.openid.Client;
    import com.pulumi.keycloak.openid.ClientArgs;
    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")
                .enabled(true)
                .build());
    
            var createRole = new Role("createRole", RoleArgs.builder()        
                .realmId(realm.id())
                .attributes(Map.of("key", "value"))
                .build());
    
            var readRole = new Role("readRole", RoleArgs.builder()        
                .realmId(realm.id())
                .attributes(Map.of("key", "value"))
                .build());
    
            var updateRole = new Role("updateRole", RoleArgs.builder()        
                .realmId(realm.id())
                .attributes(Map.of("key", "value"))
                .build());
    
            var deleteRole = new Role("deleteRole", RoleArgs.builder()        
                .realmId(realm.id())
                .attributes(Map.of("key", "value"))
                .build());
    
            var openidClient = new Client("openidClient", ClientArgs.builder()        
                .realmId(realm.id())
                .clientId("client")
                .enabled(true)
                .accessType("CONFIDENTIAL")
                .validRedirectUris("http://localhost:8080/openid-callback")
                .build());
    
            var clientRole = new Role("clientRole", RoleArgs.builder()        
                .realmId(realm.id())
                .clientId(keycloak_client.openid_client().id())
                .description("My Client Role")
                .attributes(Map.of("key", "value"))
                .build());
    
            var adminRole = new Role("adminRole", RoleArgs.builder()        
                .realmId(realm.id())
                .compositeRoles(            
                    createRole.id(),
                    readRole.id(),
                    updateRole.id(),
                    deleteRole.id(),
                    clientRole.id())
                .attributes(Map.of("key", "value"))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        realm="my-realm",
        enabled=True)
    # realm roles
    create_role = keycloak.Role("createRole",
        realm_id=realm.id,
        attributes={
            "key": "value",
        })
    read_role = keycloak.Role("readRole",
        realm_id=realm.id,
        attributes={
            "key": "value",
        })
    update_role = keycloak.Role("updateRole",
        realm_id=realm.id,
        attributes={
            "key": "value",
        })
    delete_role = keycloak.Role("deleteRole",
        realm_id=realm.id,
        attributes={
            "key": "value",
        })
    # client role
    openid_client = keycloak.openid.Client("openidClient",
        realm_id=realm.id,
        client_id="client",
        enabled=True,
        access_type="CONFIDENTIAL",
        valid_redirect_uris=["http://localhost:8080/openid-callback"])
    client_role = keycloak.Role("clientRole",
        realm_id=realm.id,
        client_id=keycloak_client["openid_client"]["id"],
        description="My Client Role",
        attributes={
            "key": "value",
        })
    admin_role = keycloak.Role("adminRole",
        realm_id=realm.id,
        composite_roles=[
            create_role.id,
            read_role.id,
            update_role.id,
            delete_role.id,
            client_role.id,
        ],
        attributes={
            "key": "value",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    
    const realm = new keycloak.Realm("realm", {
        realm: "my-realm",
        enabled: true,
    });
    // realm roles
    const createRole = new keycloak.Role("createRole", {
        realmId: realm.id,
        attributes: {
            key: "value",
        },
    });
    const readRole = new keycloak.Role("readRole", {
        realmId: realm.id,
        attributes: {
            key: "value",
        },
    });
    const updateRole = new keycloak.Role("updateRole", {
        realmId: realm.id,
        attributes: {
            key: "value",
        },
    });
    const deleteRole = new keycloak.Role("deleteRole", {
        realmId: realm.id,
        attributes: {
            key: "value",
        },
    });
    // client role
    const openidClient = new keycloak.openid.Client("openidClient", {
        realmId: realm.id,
        clientId: "client",
        enabled: true,
        accessType: "CONFIDENTIAL",
        validRedirectUris: ["http://localhost:8080/openid-callback"],
    });
    const clientRole = new keycloak.Role("clientRole", {
        realmId: realm.id,
        clientId: keycloak_client.openid_client.id,
        description: "My Client Role",
        attributes: {
            key: "value",
        },
    });
    const adminRole = new keycloak.Role("adminRole", {
        realmId: realm.id,
        compositeRoles: [
            createRole.id,
            readRole.id,
            updateRole.id,
            deleteRole.id,
            clientRole.id,
        ],
        attributes: {
            key: "value",
        },
    });
    
    resources:
      realm: # realm roles
        type: keycloak:Realm
        properties:
          realm: my-realm
          enabled: true
      createRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          attributes:
            key: value
      readRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          attributes:
            key: value
      updateRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          attributes:
            key: value
      deleteRole: # client role
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          attributes:
            key: value
      openidClient:
        type: keycloak:openid:Client
        properties:
          realmId: ${realm.id}
          clientId: client
          enabled: true
          accessType: CONFIDENTIAL
          validRedirectUris:
            - http://localhost:8080/openid-callback
      clientRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          clientId: ${keycloak_client.openid_client.id}
          description: My Client Role
          attributes:
            key: value
      adminRole:
        type: keycloak:Role
        properties:
          realmId: ${realm.id}
          compositeRoles:
            - ${createRole.id}
            - ${readRole.id}
            - ${updateRole.id}
            - ${deleteRole.id}
            - ${clientRole.id}
          attributes:
            key: value
    

    Create Role Resource

    new Role(name: string, args: RoleArgs, opts?: CustomResourceOptions);
    @overload
    def Role(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             attributes: Optional[Mapping[str, Any]] = None,
             client_id: Optional[str] = None,
             composite_roles: Optional[Sequence[str]] = None,
             description: Optional[str] = None,
             name: Optional[str] = None,
             realm_id: Optional[str] = None)
    @overload
    def Role(resource_name: str,
             args: RoleArgs,
             opts: Optional[ResourceOptions] = None)
    func NewRole(ctx *Context, name string, args RoleArgs, opts ...ResourceOption) (*Role, error)
    public Role(string name, RoleArgs args, CustomResourceOptions? opts = null)
    public Role(String name, RoleArgs args)
    public Role(String name, RoleArgs args, CustomResourceOptions options)
    
    type: keycloak:Role
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Role Resource Properties

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

    Inputs

    The Role resource accepts the following input properties:

    RealmId string

    The realm this role exists within.

    Attributes Dictionary<string, object>

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    ClientId string

    When specified, this role will be created as a client role attached to the client with the provided ID

    CompositeRoles List<string>

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    Description string

    The description of the role

    Name string

    The name of the role

    RealmId string

    The realm this role exists within.

    Attributes map[string]interface{}

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    ClientId string

    When specified, this role will be created as a client role attached to the client with the provided ID

    CompositeRoles []string

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    Description string

    The description of the role

    Name string

    The name of the role

    realmId String

    The realm this role exists within.

    attributes Map<String,Object>

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    clientId String

    When specified, this role will be created as a client role attached to the client with the provided ID

    compositeRoles List<String>

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description String

    The description of the role

    name String

    The name of the role

    realmId string

    The realm this role exists within.

    attributes {[key: string]: any}

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    clientId string

    When specified, this role will be created as a client role attached to the client with the provided ID

    compositeRoles string[]

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description string

    The description of the role

    name string

    The name of the role

    realm_id str

    The realm this role exists within.

    attributes Mapping[str, Any]

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    client_id str

    When specified, this role will be created as a client role attached to the client with the provided ID

    composite_roles Sequence[str]

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description str

    The description of the role

    name str

    The name of the role

    realmId String

    The realm this role exists within.

    attributes Map<Any>

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    clientId String

    When specified, this role will be created as a client role attached to the client with the provided ID

    compositeRoles List<String>

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description String

    The description of the role

    name String

    The name of the role

    Outputs

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

    Get an existing Role 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?: RoleState, opts?: CustomResourceOptions): Role
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            attributes: Optional[Mapping[str, Any]] = None,
            client_id: Optional[str] = None,
            composite_roles: Optional[Sequence[str]] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            realm_id: Optional[str] = None) -> Role
    func GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)
    public static Role Get(string name, Input<string> id, RoleState? state, CustomResourceOptions? opts = null)
    public static Role get(String name, Output<String> id, RoleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    Attributes Dictionary<string, object>

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    ClientId string

    When specified, this role will be created as a client role attached to the client with the provided ID

    CompositeRoles List<string>

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    Description string

    The description of the role

    Name string

    The name of the role

    RealmId string

    The realm this role exists within.

    Attributes map[string]interface{}

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    ClientId string

    When specified, this role will be created as a client role attached to the client with the provided ID

    CompositeRoles []string

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    Description string

    The description of the role

    Name string

    The name of the role

    RealmId string

    The realm this role exists within.

    attributes Map<String,Object>

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    clientId String

    When specified, this role will be created as a client role attached to the client with the provided ID

    compositeRoles List<String>

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description String

    The description of the role

    name String

    The name of the role

    realmId String

    The realm this role exists within.

    attributes {[key: string]: any}

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    clientId string

    When specified, this role will be created as a client role attached to the client with the provided ID

    compositeRoles string[]

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description string

    The description of the role

    name string

    The name of the role

    realmId string

    The realm this role exists within.

    attributes Mapping[str, Any]

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    client_id str

    When specified, this role will be created as a client role attached to the client with the provided ID

    composite_roles Sequence[str]

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description str

    The description of the role

    name str

    The name of the role

    realm_id str

    The realm this role exists within.

    attributes Map<Any>

    A map representing attributes for the role. In order to add multivalue attributes, use ## to seperate the values. Max length for each value is 255 chars

    clientId String

    When specified, this role will be created as a client role attached to the client with the provided ID

    compositeRoles List<String>

    When specified, this role will be a composite role, composed of all roles that have an ID present within this list.

    description String

    The description of the role

    name String

    The name of the role

    realmId String

    The realm this role exists within.

    Import

    Roles can be imported using the format {{realm_id}}/{{role_id}}, where role_id is the unique ID that Keycloak assigns to the role. The ID is not easy to find in the GUI, but it appears in the URL when editing the role. Examplebash

     $ pulumi import keycloak:index/role:Role role my-realm/7e8cf32a-8acb-4d34-89c4-04fb1d10ccad
    

    Package Details

    Repository
    Keycloak pulumi/pulumi-keycloak
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the keycloak Terraform Provider.

    keycloak logo
    Keycloak v5.2.1 published on Tuesday, Jun 27, 2023 by Pulumi