Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

DefaultGroups

Allows for managing a realm’s default groups.

You should not use keycloak.DefaultGroups with a group whose members are managed by keycloak.GroupMemberships.

Example Usage

using Pulumi;
using Keycloak = Pulumi.Keycloak;

class MyStack : Stack
{
    public MyStack()
    {
        var realm = new Keycloak.Realm("realm", new Keycloak.RealmArgs
        {
            Realm = "my-realm",
            Enabled = true,
        });
        var @group = new Keycloak.Group("group", new Keycloak.GroupArgs
        {
            RealmId = realm.Id,
        });
        var @default = new Keycloak.DefaultGroups("default", new Keycloak.DefaultGroupsArgs
        {
            RealmId = realm.Id,
            GroupIds = 
            {
                @group.Id,
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-keycloak/sdk/v3/go/keycloak"
    "github.com/pulumi/pulumi/sdk/v2/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
        }
        group, err := keycloak.NewGroup(ctx, "group", &keycloak.GroupArgs{
            RealmId: realm.ID(),
        })
        if err != nil {
            return err
        }
        _, err = keycloak.NewDefaultGroups(ctx, "_default", &keycloak.DefaultGroupsArgs{
            RealmId: realm.ID(),
            GroupIds: pulumi.StringArray{
                group.ID(),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_keycloak as keycloak

realm = keycloak.Realm("realm",
    realm="my-realm",
    enabled=True)
group = keycloak.Group("group", realm_id=realm.id)
default = keycloak.DefaultGroups("default",
    realm_id=realm.id,
    group_ids=[group.id])
import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";

const realm = new keycloak.Realm("realm", {
    realm: "my-realm",
    enabled: true,
});
const group = new keycloak.Group("group", {realmId: realm.id});
const _default = new keycloak.DefaultGroups("default", {
    realmId: realm.id,
    groupIds: [group.id],
});

Create a DefaultGroups Resource

new DefaultGroups(name: string, args: DefaultGroupsArgs, opts?: CustomResourceOptions);
def DefaultGroups(resource_name: str, opts: Optional[ResourceOptions] = None, group_ids: Optional[Sequence[str]] = None, realm_id: Optional[str] = None)
func NewDefaultGroups(ctx *Context, name string, args DefaultGroupsArgs, opts ...ResourceOption) (*DefaultGroups, error)
public DefaultGroups(string name, DefaultGroupsArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DefaultGroupsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DefaultGroupsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DefaultGroupsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

DefaultGroups Resource Properties

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

Inputs

The DefaultGroups resource accepts the following input properties:

GroupIds List<string>

A set of group ids that should be default groups on the realm referenced by realm_id.

RealmId string

The realm this group exists in.

GroupIds []string

A set of group ids that should be default groups on the realm referenced by realm_id.

RealmId string

The realm this group exists in.

groupIds string[]

A set of group ids that should be default groups on the realm referenced by realm_id.

realmId string

The realm this group exists in.

group_ids Sequence[str]

A set of group ids that should be default groups on the realm referenced by realm_id.

realm_id str

The realm this group exists in.

Outputs

All input properties are implicitly available as output properties. Additionally, the DefaultGroups 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing DefaultGroups Resource

Get an existing DefaultGroups 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?: DefaultGroupsState, opts?: CustomResourceOptions): DefaultGroups
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, group_ids: Optional[Sequence[str]] = None, realm_id: Optional[str] = None) -> DefaultGroups
func GetDefaultGroups(ctx *Context, name string, id IDInput, state *DefaultGroupsState, opts ...ResourceOption) (*DefaultGroups, error)
public static DefaultGroups Get(string name, Input<string> id, DefaultGroupsState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

GroupIds List<string>

A set of group ids that should be default groups on the realm referenced by realm_id.

RealmId string

The realm this group exists in.

GroupIds []string

A set of group ids that should be default groups on the realm referenced by realm_id.

RealmId string

The realm this group exists in.

groupIds string[]

A set of group ids that should be default groups on the realm referenced by realm_id.

realmId string

The realm this group exists in.

group_ids Sequence[str]

A set of group ids that should be default groups on the realm referenced by realm_id.

realm_id str

The realm this group exists in.

Import

Default groups can be imported using the format {{realm_id}} where realm_id is the realm the group exists in. Examplebash

 $ pulumi import keycloak:index/defaultGroups:DefaultGroups default my-realm

Package Details

Repository
https://github.com/pulumi/pulumi-keycloak
License
Apache-2.0
Notes
This Pulumi package is based on the keycloak Terraform Provider.