keycloak.RealmDefaultClientScopes
Explore with Pulumi AI
Allows you to manage the set of default client scopes for a Keycloak realm, which are used when new clients are created.
Note that this resource attempts to be an authoritative source over the default client scopes for a Keycloak realm, so any Keycloak defaults and manual adjustments will be overwritten.
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 clientScope = new keycloak.openid.ClientScope("client_scope", {
realmId: realm.id,
name: "test-client-scope",
});
const defaultScopes = new keycloak.RealmDefaultClientScopes("default_scopes", {
realmId: realm.id,
defaultScopes: [
"profile",
"email",
"roles",
"web-origins",
clientScope.name,
],
});
import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm",
realm="my-realm",
enabled=True)
client_scope = keycloak.openid.ClientScope("client_scope",
realm_id=realm.id,
name="test-client-scope")
default_scopes = keycloak.RealmDefaultClientScopes("default_scopes",
realm_id=realm.id,
default_scopes=[
"profile",
"email",
"roles",
"web-origins",
client_scope.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
}
clientScope, err := openid.NewClientScope(ctx, "client_scope", &openid.ClientScopeArgs{
RealmId: realm.ID(),
Name: pulumi.String("test-client-scope"),
})
if err != nil {
return err
}
_, err = keycloak.NewRealmDefaultClientScopes(ctx, "default_scopes", &keycloak.RealmDefaultClientScopesArgs{
RealmId: realm.ID(),
DefaultScopes: pulumi.StringArray{
pulumi.String("profile"),
pulumi.String("email"),
pulumi.String("roles"),
pulumi.String("web-origins"),
clientScope.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 clientScope = new Keycloak.OpenId.ClientScope("client_scope", new()
{
RealmId = realm.Id,
Name = "test-client-scope",
});
var defaultScopes = new Keycloak.RealmDefaultClientScopes("default_scopes", new()
{
RealmId = realm.Id,
DefaultScopes = new[]
{
"profile",
"email",
"roles",
"web-origins",
clientScope.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.ClientScope;
import com.pulumi.keycloak.openid.ClientScopeArgs;
import com.pulumi.keycloak.RealmDefaultClientScopes;
import com.pulumi.keycloak.RealmDefaultClientScopesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var realm = new Realm("realm", RealmArgs.builder()
.realm("my-realm")
.enabled(true)
.build());
var clientScope = new ClientScope("clientScope", ClientScopeArgs.builder()
.realmId(realm.id())
.name("test-client-scope")
.build());
var defaultScopes = new RealmDefaultClientScopes("defaultScopes", RealmDefaultClientScopesArgs.builder()
.realmId(realm.id())
.defaultScopes(
"profile",
"email",
"roles",
"web-origins",
clientScope.name())
.build());
}
}
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
enabled: true
clientScope:
type: keycloak:openid:ClientScope
name: client_scope
properties:
realmId: ${realm.id}
name: test-client-scope
defaultScopes:
type: keycloak:RealmDefaultClientScopes
name: default_scopes
properties:
realmId: ${realm.id}
defaultScopes:
- profile
- email
- roles
- web-origins
- ${clientScope.name}
Create RealmDefaultClientScopes Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RealmDefaultClientScopes(name: string, args: RealmDefaultClientScopesArgs, opts?: CustomResourceOptions);
@overload
def RealmDefaultClientScopes(resource_name: str,
args: RealmDefaultClientScopesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RealmDefaultClientScopes(resource_name: str,
opts: Optional[ResourceOptions] = None,
default_scopes: Optional[Sequence[str]] = None,
realm_id: Optional[str] = None)
func NewRealmDefaultClientScopes(ctx *Context, name string, args RealmDefaultClientScopesArgs, opts ...ResourceOption) (*RealmDefaultClientScopes, error)
public RealmDefaultClientScopes(string name, RealmDefaultClientScopesArgs args, CustomResourceOptions? opts = null)
public RealmDefaultClientScopes(String name, RealmDefaultClientScopesArgs args)
public RealmDefaultClientScopes(String name, RealmDefaultClientScopesArgs args, CustomResourceOptions options)
type: keycloak:RealmDefaultClientScopes
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RealmDefaultClientScopesArgs
- 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 RealmDefaultClientScopesArgs
- 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 RealmDefaultClientScopesArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RealmDefaultClientScopesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RealmDefaultClientScopesArgs
- 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 realmDefaultClientScopesResource = new Keycloak.RealmDefaultClientScopes("realmDefaultClientScopesResource", new()
{
DefaultScopes = new[]
{
"string",
},
RealmId = "string",
});
example, err := keycloak.NewRealmDefaultClientScopes(ctx, "realmDefaultClientScopesResource", &keycloak.RealmDefaultClientScopesArgs{
DefaultScopes: pulumi.StringArray{
pulumi.String("string"),
},
RealmId: pulumi.String("string"),
})
var realmDefaultClientScopesResource = new RealmDefaultClientScopes("realmDefaultClientScopesResource", RealmDefaultClientScopesArgs.builder()
.defaultScopes("string")
.realmId("string")
.build());
realm_default_client_scopes_resource = keycloak.RealmDefaultClientScopes("realmDefaultClientScopesResource",
default_scopes=["string"],
realm_id="string")
const realmDefaultClientScopesResource = new keycloak.RealmDefaultClientScopes("realmDefaultClientScopesResource", {
defaultScopes: ["string"],
realmId: "string",
});
type: keycloak:RealmDefaultClientScopes
properties:
defaultScopes:
- string
realmId: string
RealmDefaultClientScopes 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 RealmDefaultClientScopes resource accepts the following input properties:
- Default
Scopes List<string> - An array of default client scope names that should be used when creating new Keycloak clients.
- Realm
Id string - The realm this client and scopes exists in.
- Default
Scopes []string - An array of default client scope names that should be used when creating new Keycloak clients.
- Realm
Id string - The realm this client and scopes exists in.
- default
Scopes List<String> - An array of default client scope names that should be used when creating new Keycloak clients.
- realm
Id String - The realm this client and scopes exists in.
- default
Scopes string[] - An array of default client scope names that should be used when creating new Keycloak clients.
- realm
Id string - The realm this client and scopes exists in.
- default_
scopes Sequence[str] - An array of default client scope names that should be used when creating new Keycloak clients.
- realm_
id str - The realm this client and scopes exists in.
- default
Scopes List<String> - An array of default client scope names that should be used when creating new Keycloak clients.
- realm
Id String - The realm this client and scopes exists in.
Outputs
All input properties are implicitly available as output properties. Additionally, the RealmDefaultClientScopes resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing RealmDefaultClientScopes Resource
Get an existing RealmDefaultClientScopes 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?: RealmDefaultClientScopesState, opts?: CustomResourceOptions): RealmDefaultClientScopes
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
default_scopes: Optional[Sequence[str]] = None,
realm_id: Optional[str] = None) -> RealmDefaultClientScopes
func GetRealmDefaultClientScopes(ctx *Context, name string, id IDInput, state *RealmDefaultClientScopesState, opts ...ResourceOption) (*RealmDefaultClientScopes, error)
public static RealmDefaultClientScopes Get(string name, Input<string> id, RealmDefaultClientScopesState? state, CustomResourceOptions? opts = null)
public static RealmDefaultClientScopes get(String name, Output<String> id, RealmDefaultClientScopesState state, CustomResourceOptions options)
resources: _: type: keycloak:RealmDefaultClientScopes get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Default
Scopes List<string> - An array of default client scope names that should be used when creating new Keycloak clients.
- Realm
Id string - The realm this client and scopes exists in.
- Default
Scopes []string - An array of default client scope names that should be used when creating new Keycloak clients.
- Realm
Id string - The realm this client and scopes exists in.
- default
Scopes List<String> - An array of default client scope names that should be used when creating new Keycloak clients.
- realm
Id String - The realm this client and scopes exists in.
- default
Scopes string[] - An array of default client scope names that should be used when creating new Keycloak clients.
- realm
Id string - The realm this client and scopes exists in.
- default_
scopes Sequence[str] - An array of default client scope names that should be used when creating new Keycloak clients.
- realm_
id str - The realm this client and scopes exists in.
- default
Scopes List<String> - An array of default client scope names that should be used when creating new Keycloak clients.
- realm
Id String - The realm this client and scopes exists in.
Import
This resource does not support import. Instead of importing, feel free to create this resource
as if it did not already exist on the server.
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.