1. Packages
  2. Keycloak
  3. API Docs
  4. getGroup
Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi

keycloak.getGroup

Explore with Pulumi AI

keycloak logo
Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi

    # keycloak.Group data source

    This data source can be used to fetch properties of a Keycloak group for usage with other resources, such as keycloak.GroupRoles.

    Example Usage

    Coming soon!```
    </pulumi-choosable>
    </div>
    <div>
    <pulumi-choosable type="language" values="python">
    

    Coming soon!```

    Coming soon!```
    </pulumi-choosable>
    </div>
    <div>
    <pulumi-choosable type="language" values="csharp">
    

    Coming soon!```

    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()        
                .enabled(true)
                .realm("my-realm")
                .build());
    
            final var offlineAccess = KeycloakFunctions.getRole(GetRoleArgs.builder()
                .name("offline_access")
                .realmId(realm.id())
                .build());
    
            final var group = KeycloakFunctions.getGroup(GetGroupArgs.builder()
                .name("group")
                .realmId(realm.id())
                .build());
    
            var groupRoles = new GroupRoles("groupRoles", GroupRolesArgs.builder()        
                .groupId(group.applyValue(getGroupResult -> getGroupResult).applyValue(group -> group.applyValue(getGroupResult -> getGroupResult.id())))
                .realmId(realm.id())
                .roles(offlineAccess.applyValue(getRoleResult -> getRoleResult).applyValue(offlineAccess -> offlineAccess.applyValue(getRoleResult -> getRoleResult.id())))
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          enabled: true
          realm: my-realm
      groupRoles:
        type: keycloak:GroupRoles
        properties:
          groupId: ${group.id}
          realmId: ${realm.id}
          roles:
            - ${offlineAccess.id}
    variables:
      offlineAccess:
        fn::invoke:
          Function: keycloak:getRole
          Arguments:
            name: offline_access
            realmId: ${realm.id}
      group:
        fn::invoke:
          Function: keycloak:getGroup
          Arguments:
            name: group
            realmId: ${realm.id}
    

    Argument Reference

    The following arguments are supported:

    • realm_id - (Required) The realm this group exists within.
    • name - (Required) The name of the group

    Attributes Reference

    In addition to the arguments listed above, the following computed attributes are exported:

    • id - The unique ID of the group, which can be used as an argument to other resources supported by this provider.

    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(name: Optional[str] = None,
                  realm_id: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetGroupResult
    def get_group_output(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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: keycloak:index/getGroup:getGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    RealmId string
    Name string
    RealmId string
    name String
    realmId String
    name string
    realmId string
    name str
    realm_id str
    name String
    realmId String

    getGroup Result

    The following output properties are available:

    Attributes Dictionary<string, object>
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    ParentId string
    Path string
    RealmId string
    Attributes map[string]interface{}
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    ParentId string
    Path string
    RealmId string
    attributes Map<String,Object>
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    parentId String
    path String
    realmId String
    attributes {[key: string]: any}
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    parentId string
    path string
    realmId string
    attributes Mapping[str, Any]
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    parent_id str
    path str
    realm_id str
    attributes Map<Any>
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    parentId String
    path String
    realmId String

    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.3.1 published on Monday, Mar 11, 2024 by Pulumi