Viewing docs for Keycloak v6.10.0
published on Saturday, Feb 21, 2026 by Pulumi
published on Saturday, Feb 21, 2026 by Pulumi
Viewing docs for Keycloak v6.10.0
published on Saturday, Feb 21, 2026 by Pulumi
published on Saturday, Feb 21, 2026 by Pulumi
This data source can be used to fetch properties of a Keycloak group for
usage with other resources, such as keycloak.GroupRoles.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";
const realm = new keycloak.Realm("realm", {
realm: "my-realm",
enabled: true,
});
const offlineAccess = keycloak.getRoleOutput({
realmId: realm.id,
name: "offline_access",
});
const group = keycloak.getGroupOutput({
realmId: realm.id,
name: "group",
});
const groupRoles = new keycloak.GroupRoles("group_roles", {
realmId: realm.id,
groupId: group.apply(group => group.id),
roleIds: [offlineAccess.apply(offlineAccess => offlineAccess.id)],
});
import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm",
realm="my-realm",
enabled=True)
offline_access = keycloak.get_role_output(realm_id=realm.id,
name="offline_access")
group = keycloak.get_group_output(realm_id=realm.id,
name="group")
group_roles = keycloak.GroupRoles("group_roles",
realm_id=realm.id,
group_id=group.id,
role_ids=[offline_access.id])
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"),
Enabled: pulumi.Bool(true),
})
if err != nil {
return err
}
offlineAccess := keycloak.LookupRoleOutput(ctx, keycloak.GetRoleOutputArgs{
RealmId: realm.ID(),
Name: pulumi.String("offline_access"),
}, nil)
group := keycloak.LookupGroupOutput(ctx, keycloak.GetGroupOutputArgs{
RealmId: realm.ID(),
Name: pulumi.String("group"),
}, nil)
_, err = keycloak.NewGroupRoles(ctx, "group_roles", &keycloak.GroupRolesArgs{
RealmId: realm.ID(),
GroupId: pulumi.String(group.ApplyT(func(group keycloak.GetGroupResult) (*string, error) {
return &group.Id, nil
}).(pulumi.StringPtrOutput)),
RoleIds: pulumi.StringArray{
pulumi.String(offlineAccess.ApplyT(func(offlineAccess keycloak.GetRoleResult) (*string, error) {
return &offlineAccess.Id, nil
}).(pulumi.StringPtrOutput)),
},
})
if err != nil {
return err
}
return nil
})
}
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 offlineAccess = Keycloak.GetRole.Invoke(new()
{
RealmId = realm.Id,
Name = "offline_access",
});
var @group = Keycloak.GetGroup.Invoke(new()
{
RealmId = realm.Id,
Name = "group",
});
var groupRoles = new Keycloak.GroupRoles("group_roles", new()
{
RealmId = realm.Id,
GroupId = @group.Apply(@group => @group.Apply(getGroupResult => getGroupResult.Id)),
RoleIds = new[]
{
offlineAccess.Apply(getRoleResult => getRoleResult.Id),
},
});
});
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.KeycloakFunctions;
import com.pulumi.keycloak.inputs.GetRoleArgs;
import com.pulumi.keycloak.inputs.GetGroupArgs;
import com.pulumi.keycloak.GroupRoles;
import com.pulumi.keycloak.GroupRolesArgs;
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());
final var offlineAccess = KeycloakFunctions.getRole(GetRoleArgs.builder()
.realmId(realm.id())
.name("offline_access")
.build());
final var group = KeycloakFunctions.getGroup(GetGroupArgs.builder()
.realmId(realm.id())
.name("group")
.build());
var groupRoles = new GroupRoles("groupRoles", GroupRolesArgs.builder()
.realmId(realm.id())
.groupId(group.applyValue(_group -> _group.id()))
.roleIds(offlineAccess.applyValue(_offlineAccess -> _offlineAccess.id()))
.build());
}
}
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
enabled: true
groupRoles:
type: keycloak:GroupRoles
name: group_roles
properties:
realmId: ${realm.id}
groupId: ${group.id}
roleIds:
- ${offlineAccess.id}
variables:
offlineAccess:
fn::invoke:
function: keycloak:getRole
arguments:
realmId: ${realm.id}
name: offline_access
group:
fn::invoke:
function: keycloak:getGroup
arguments:
realmId: ${realm.id}
name: group
Using getGroup
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getGroup(args: GetGroupArgs, opts?: InvokeOptions): Promise<GetGroupResult>
function getGroupOutput(args: GetGroupOutputArgs, opts?: InvokeOptions): Output<GetGroupResult>def get_group(description: Optional[str] = None,
name: Optional[str] = None,
realm_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetGroupResult
def get_group_output(description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
realm_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetGroupResult]func LookupGroup(ctx *Context, args *LookupGroupArgs, opts ...InvokeOption) (*LookupGroupResult, error)
func LookupGroupOutput(ctx *Context, args *LookupGroupOutputArgs, opts ...InvokeOption) LookupGroupResultOutput> Note: This function is named LookupGroup in the Go SDK.
public static class GetGroup
{
public static Task<GetGroupResult> InvokeAsync(GetGroupArgs args, InvokeOptions? opts = null)
public static Output<GetGroupResult> Invoke(GetGroupInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetGroupResult> getGroup(GetGroupArgs args, InvokeOptions options)
public static Output<GetGroupResult> getGroup(GetGroupArgs args, InvokeOptions options)
fn::invoke:
function: keycloak:index/getGroup:getGroup
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- The name of the group. If there are multiple groups match
name, the first result will be returned. - Realm
Id string - The realm this group exists within.
- Description string
- Name string
- The name of the group. If there are multiple groups match
name, the first result will be returned. - Realm
Id string - The realm this group exists within.
- Description string
- name String
- The name of the group. If there are multiple groups match
name, the first result will be returned. - realm
Id String - The realm this group exists within.
- description String
- name string
- The name of the group. If there are multiple groups match
name, the first result will be returned. - realm
Id string - The realm this group exists within.
- description string
- name str
- The name of the group. If there are multiple groups match
name, the first result will be returned. - realm_
id str - The realm this group exists within.
- description str
- name String
- The name of the group. If there are multiple groups match
name, the first result will be returned. - realm
Id String - The realm this group exists within.
- description String
getGroup Result
The following output properties are available:
- Attributes Dictionary<string, string>
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Parent
Id string - Path string
- Realm
Id string - Description string
- Attributes map[string]string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Parent
Id string - Path string
- Realm
Id string - Description string
- attributes Map<String,String>
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- parent
Id String - path String
- realm
Id String - description String
- attributes {[key: string]: string}
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- parent
Id string - path string
- realm
Id string - description string
- attributes Mapping[str, str]
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- parent_
id str - path str
- realm_
id str - description str
- attributes Map<String>
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- parent
Id String - path String
- realm
Id String - description String
Package Details
- Repository
- Keycloak pulumi/pulumi-keycloak
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
keycloakTerraform Provider.
Viewing docs for Keycloak v6.10.0
published on Saturday, Feb 21, 2026 by Pulumi
published on Saturday, Feb 21, 2026 by Pulumi
