1. Registry
  2. Packages
  3. Keycloak Provider
  4. API Docs
  5. ClientScopeAssignments
Viewing docs for Keycloak v6.15.0
published on Saturday, Nov 21, 2026 by Pulumi
keycloak logo keycloak logo
Viewing docs for Keycloak v6.15.0
published on Saturday, Nov 21, 2026 by Pulumi

    Authoritatively manages both default and optional client-scope assignments for one realm or one client. Omit clientId to manage realm defaults; specify the Keycloak-generated client ID to manage a client’s assignments. SAML clients support both assignment categories through Keycloak’s default and optional client-scope endpoints. Only openid-connect and saml clients are supported. SAML clients require saml scopes; OpenID Connect clients accept both openid-connect and oid4vc (verifiable-credential) scopes.

    Declare one resource per target and configure both sets together. A scope cannot appear in both sets; Terraform validates this overlap during planning when both sets are known, and checks again before writing at apply time. Moving a scope between sets detaches it from the old category before attaching it to the new one.

    During that update, the scope is briefly unassigned because Keycloak exposes separate remove and add operations. Tokens issued in that interval will not include the scope.

    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 web = new keycloak.openid.Client("web", {
        realmId: realm.id,
        clientId: "web",
        accessType: "CONFIDENTIAL",
    });
    const groups = new keycloak.openid.ClientScope("groups", {
        realmId: realm.id,
        name: "groups",
    });
    const webClient = new keycloak.ClientScopeAssignments("web_client", {
        realmId: realm.id,
        clientId: web.id,
        defaultScopes: [
            "profile",
            "email",
            "roles",
            "web-origins",
            "acr",
            "basic",
        ],
        optionalScopes: [groups.name],
    });
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        realm="my-realm",
        enabled=True)
    web = keycloak.openid.Client("web",
        realm_id=realm.id,
        client_id="web",
        access_type="CONFIDENTIAL")
    groups = keycloak.openid.ClientScope("groups",
        realm_id=realm.id,
        name="groups")
    web_client = keycloak.ClientScopeAssignments("web_client",
        realm_id=realm.id,
        client_id=web.id,
        default_scopes=[
            "profile",
            "email",
            "roles",
            "web-origins",
            "acr",
            "basic",
        ],
        optional_scopes=[groups.name])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v6/go/keycloak"
    	"github.com/pulumi/pulumi-keycloak/sdk/v6/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
    		}
    		web, err := openid.NewClient(ctx, "web", &openid.ClientArgs{
    			RealmId:    realm.ID(),
    			ClientId:   pulumi.String("web"),
    			AccessType: pulumi.String("CONFIDENTIAL"),
    		})
    		if err != nil {
    			return err
    		}
    		groups, err := openid.NewClientScope(ctx, "groups", &openid.ClientScopeArgs{
    			RealmId: realm.ID(),
    			Name:    pulumi.String("groups"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keycloak.NewClientScopeAssignments(ctx, "web_client", &keycloak.ClientScopeAssignmentsArgs{
    			RealmId:  realm.ID(),
    			ClientId: web.ID(),
    			DefaultScopes: pulumi.StringArray{
    				pulumi.String("profile"),
    				pulumi.String("email"),
    				pulumi.String("roles"),
    				pulumi.String("web-origins"),
    				pulumi.String("acr"),
    				pulumi.String("basic"),
    			},
    			OptionalScopes: pulumi.StringArray{
    				groups.Name,
    			},
    		})
    		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 web = new Keycloak.OpenId.Client("web", new()
        {
            RealmId = realm.Id,
            ClientId = "web",
            AccessType = "CONFIDENTIAL",
        });
    
        var groups = new Keycloak.OpenId.ClientScope("groups", new()
        {
            RealmId = realm.Id,
            Name = "groups",
        });
    
        var webClient = new Keycloak.ClientScopeAssignments("web_client", new()
        {
            RealmId = realm.Id,
            ClientId = web.Id,
            DefaultScopes = new[]
            {
                "profile",
                "email",
                "roles",
                "web-origins",
                "acr",
                "basic",
            },
            OptionalScopes = new[]
            {
                groups.Name,
            },
        });
    
    });
    
    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.openid.ClientScope;
    import com.pulumi.keycloak.openid.ClientScopeArgs;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import com.pulumi.keycloak.ClientScopeAssignmentsArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 web = new Client("web", ClientArgs.builder()
                .realmId(realm.id())
                .clientId("web")
                .accessType("CONFIDENTIAL")
                .build());
    
            var groups = new ClientScope("groups", ClientScopeArgs.builder()
                .realmId(realm.id())
                .name("groups")
                .build());
    
            var webClient = new ClientScopeAssignments("webClient", ClientScopeAssignmentsArgs.builder()
                .realmId(realm.id())
                .clientId(web.id())
                .defaultScopes(            
                    "profile",
                    "email",
                    "roles",
                    "web-origins",
                    "acr",
                    "basic")
                .optionalScopes(groups.name())
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          realm: my-realm
          enabled: true
      web:
        type: keycloak:openid:Client
        properties:
          realmId: ${realm.id}
          clientId: web
          accessType: CONFIDENTIAL
      groups:
        type: keycloak:openid:ClientScope
        properties:
          realmId: ${realm.id}
          name: groups
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
        properties:
          realmId: ${realm.id}
          clientId: ${web.id}
          defaultScopes:
            - profile
            - email
            - roles
            - web-origins
            - acr
            - basic
          optionalScopes:
            - ${groups.name}
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_realm" "realm" {
      lifecycle {
        create_before_destroy = true
      }
      realm   = "my-realm"
      enabled = true
    }
    resource "keycloak_openid_client" "web" {
      lifecycle {
        create_before_destroy = true
      }
      realm_id    = keycloak_realm.realm.id
      client_id   = "web"
      access_type = "CONFIDENTIAL"
    }
    resource "keycloak_openid_client_scope" "groups" {
      lifecycle {
        create_before_destroy = true
      }
      realm_id = keycloak_realm.realm.id
      name     = "groups"
    }
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
      realm_id        = keycloak_realm.realm.id
      client_id       = keycloak_openid_client.web.id
      default_scopes  = ["profile", "email", "roles", "web-origins", "acr", "basic"]
      optional_scopes = [keycloak_openid_client_scope.groups.name]
    }
    

    Create ClientScopeAssignments Resource

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

    Constructor syntax

    new ClientScopeAssignments(name: string, args: ClientScopeAssignmentsArgs, opts?: CustomResourceOptions);
    @overload
    def ClientScopeAssignments(resource_name: str,
                               args: ClientScopeAssignmentsArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ClientScopeAssignments(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               default_scopes: Optional[Sequence[str]] = None,
                               optional_scopes: Optional[Sequence[str]] = None,
                               client_id: Optional[str] = None,
                               realm_id: Optional[str] = None,
                               realm_internal_id: Optional[str] = None)
    func NewClientScopeAssignments(ctx *Context, name string, args ClientScopeAssignmentsArgs, opts ...ResourceOption) (*ClientScopeAssignments, error)
    public ClientScopeAssignments(string name, ClientScopeAssignmentsArgs args, CustomResourceOptions? opts = null)
    public ClientScopeAssignments(String name, ClientScopeAssignmentsArgs args)
    public ClientScopeAssignments(String name, ClientScopeAssignmentsArgs args, CustomResourceOptions options)
    
    type: keycloak:ClientScopeAssignments
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "keycloak_client_scope_assignments" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ClientScopeAssignmentsArgs
    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 ClientScopeAssignmentsArgs
    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 ClientScopeAssignmentsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClientScopeAssignmentsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClientScopeAssignmentsArgs
    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 clientScopeAssignmentsResource = new Keycloak.ClientScopeAssignments("clientScopeAssignmentsResource", new()
    {
        DefaultScopes = new[]
        {
            "string",
        },
        OptionalScopes = new[]
        {
            "string",
        },
        ClientId = "string",
        RealmId = "string",
        RealmInternalId = "string",
    });
    
    example, err := keycloak.NewClientScopeAssignments(ctx, "clientScopeAssignmentsResource", &keycloak.ClientScopeAssignmentsArgs{
    	DefaultScopes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	OptionalScopes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	ClientId:        pulumi.String("string"),
    	RealmId:         pulumi.String("string"),
    	RealmInternalId: pulumi.String("string"),
    })
    
    resource "keycloak_client_scope_assignments" "clientScopeAssignmentsResource" {
      lifecycle {
        create_before_destroy = true
      }
      default_scopes    = ["string"]
      optional_scopes   = ["string"]
      client_id         = "string"
      realm_id          = "string"
      realm_internal_id = "string"
    }
    
    var clientScopeAssignmentsResource = new ClientScopeAssignments("clientScopeAssignmentsResource", ClientScopeAssignmentsArgs.builder()
        .defaultScopes("string")
        .optionalScopes("string")
        .clientId("string")
        .realmId("string")
        .realmInternalId("string")
        .build());
    
    client_scope_assignments_resource = keycloak.ClientScopeAssignments("clientScopeAssignmentsResource",
        default_scopes=["string"],
        optional_scopes=["string"],
        client_id="string",
        realm_id="string",
        realm_internal_id="string")
    
    const clientScopeAssignmentsResource = new keycloak.ClientScopeAssignments("clientScopeAssignmentsResource", {
        defaultScopes: ["string"],
        optionalScopes: ["string"],
        clientId: "string",
        realmId: "string",
        realmInternalId: "string",
    });
    
    type: keycloak:ClientScopeAssignments
    properties:
        clientId: string
        defaultScopes:
            - string
        optionalScopes:
            - string
        realmId: string
        realmInternalId: string
    

    ClientScopeAssignments 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 ClientScopeAssignments resource accepts the following input properties:

    DefaultScopes List<string>
    Set of client-scope names assigned as defaults.
    OptionalScopes List<string>

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    ClientId string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    RealmId string
    The target realm.
    RealmInternalId string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    DefaultScopes []string
    Set of client-scope names assigned as defaults.
    OptionalScopes []string

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    ClientId string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    RealmId string
    The target realm.
    RealmInternalId string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    default_scopes list(string)
    Set of client-scope names assigned as defaults.
    optional_scopes list(string)

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    client_id string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    realm_id string
    The target realm.
    realm_internal_id string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    defaultScopes List<String>
    Set of client-scope names assigned as defaults.
    optionalScopes List<String>

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    clientId String
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    realmId String
    The target realm.
    realmInternalId String
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    defaultScopes string[]
    Set of client-scope names assigned as defaults.
    optionalScopes string[]

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    clientId string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    realmId string
    The target realm.
    realmInternalId string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    default_scopes Sequence[str]
    Set of client-scope names assigned as defaults.
    optional_scopes Sequence[str]

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    client_id str
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    realm_id str
    The target realm.
    realm_internal_id str
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    defaultScopes List<String>
    Set of client-scope names assigned as defaults.
    optionalScopes List<String>

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    clientId String
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    realmId String
    The target realm.
    realmInternalId String
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.

    Outputs

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

    Get an existing ClientScopeAssignments 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?: ClientScopeAssignmentsState, opts?: CustomResourceOptions): ClientScopeAssignments
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_id: Optional[str] = None,
            default_scopes: Optional[Sequence[str]] = None,
            optional_scopes: Optional[Sequence[str]] = None,
            realm_id: Optional[str] = None,
            realm_internal_id: Optional[str] = None) -> ClientScopeAssignments
    func GetClientScopeAssignments(ctx *Context, name string, id IDInput, state *ClientScopeAssignmentsState, opts ...ResourceOption) (*ClientScopeAssignments, error)
    public static ClientScopeAssignments Get(string name, Input<string> id, ClientScopeAssignmentsState? state, CustomResourceOptions? opts = null)
    public static ClientScopeAssignments get(String name, Output<String> id, ClientScopeAssignmentsState state, CustomResourceOptions options)
    resources:  existingClientScopeAssignments:    type: keycloak:ClientScopeAssignments    get:      id: ${id}
    import {
      to = keycloak_client_scope_assignments.example
      id = "${id}"
    }
    
    name string
    The unique name of the resulting resource.
    id Input<ID>
    The unique provider ID of the resource to look up.
    state ClientScopeAssignmentsState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resulting resource.
    id str
    The unique provider ID of the resource to look up.
    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 resulting resource.
    id IDInput
    The unique provider ID of the resource to look up.
    state ClientScopeAssignmentsState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resulting resource.
    id Input<string>
    The unique provider ID of the resource to look up.
    state ClientScopeAssignmentsState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resulting resource.
    id Output<String>
    The unique provider ID of the resource to look up.
    state ClientScopeAssignmentsState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    options CustomResourceOptions
    Bag of options to control resource's behavior.
    The following state arguments are supported:
    ClientId string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    DefaultScopes List<string>
    Set of client-scope names assigned as defaults.
    OptionalScopes List<string>

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    RealmId string
    The target realm.
    RealmInternalId string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    ClientId string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    DefaultScopes []string
    Set of client-scope names assigned as defaults.
    OptionalScopes []string

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    RealmId string
    The target realm.
    RealmInternalId string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    client_id string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    default_scopes list(string)
    Set of client-scope names assigned as defaults.
    optional_scopes list(string)

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    realm_id string
    The target realm.
    realm_internal_id string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    clientId String
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    defaultScopes List<String>
    Set of client-scope names assigned as defaults.
    optionalScopes List<String>

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    realmId String
    The target realm.
    realmInternalId String
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    clientId string
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    defaultScopes string[]
    Set of client-scope names assigned as defaults.
    optionalScopes string[]

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    realmId string
    The target realm.
    realmInternalId string
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    client_id str
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    default_scopes Sequence[str]
    Set of client-scope names assigned as defaults.
    optional_scopes Sequence[str]

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    realm_id str
    The target realm.
    realm_internal_id str
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.
    clientId String
    The Keycloak-generated ID of the client. If omitted, assignments apply to the realm. Must not be empty when set.
    defaultScopes List<String>
    Set of client-scope names assigned as defaults.
    optionalScopes List<String>

    Set of client-scope names assigned as optional.

    The resource is authoritative for the target's assignments. Existing assignments not listed in either set are removed, including Keycloak's built-in defaults. Include every assignment you want to retain; the provider does not inject built-in or custom scopes into your configured sets. Realm assignments set defaults for newly created clients; they do not retroactively update existing clients.

    Creating this resource for an existing target removes any assignment not listed, and the plan does not show those removals. Import the target first so the plan shows its current assignments before you apply.

    Destroying or replacing this resource detaches the assignments it manages. To prevent accidental destruction or replacement, use Terraform's built-in lifecycle.prevent_destroy:

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    

    const webClient = new keycloak.ClientScopeAssignments("web_client", {});

    import pulumi
    import pulumi_keycloak as keycloak
    
    web_client = keycloak.ClientScopeAssignments("web_client")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var webClient = new Keycloak.ClientScopeAssignments("web_client");
    
    });
    
    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 {
    		_, err := keycloak.NewClientScopeAssignments(ctx, "web_client", nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    terraform {
      required_providers {
        keycloak = {
          source = "pulumi/keycloak"
        }
      }
    }
    
    resource "keycloak_client_scope_assignments" "web_client" {
      lifecycle {
        create_before_destroy = true
      }
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.ClientScopeAssignments;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 webClient = new ClientScopeAssignments("webClient");
    
        }
    }
    
    resources:
      webClient:
        type: keycloak:ClientScopeAssignments
        name: web_client
    

    Declare exactly one assignments resource per target, including across modules and Terraform states. Do not manage the same target's assignments with a deprecated assignment resource, or manage realm assignments alongside keycloak_realm.default_default_client_scopes or keycloak_realm.default_optional_client_scopes. These independent resources cannot validate each other's ownership and will overwrite each other's assignments.

    To migrate without detaching assignments, remove every old assignment resource for the target from configuration (for example, both the default and optional scopes resources), run terraform state rm for each of their addresses, then import the target into this resource using the import format below. Removing only one leaves the other managing the same target, or detaching its assignments when it is later removed. Review the resulting plan before applying.

    realmId String
    The target realm.
    realmInternalId String
    The internal id of the realm, as an alternative to realm_id. Unlike the realm name, it does not change when the realm is renamed.

    Import

    Import a realm target with realm/<realm_id> or a client target with client/<realm_id>/<client_id>.

    $ pulumi import keycloak:index/clientScopeAssignments:ClientScopeAssignments web_client client/my-realm/8e8f7fe1-df9b-40ed-bed3-4597aa0dac52
    

    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.
    keycloak logo keycloak logo
    Viewing docs for Keycloak v6.15.0
    published on Saturday, Nov 21, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial