Keycloak v5.3.2 published on Friday, May 10, 2024 by Pulumi
keycloak.getRole
Explore with Pulumi AI
# keycloak.Role data source
This data source can be used to fetch properties of a Keycloak role for
usage with other resources, such as keycloak.GroupRoles
.
Example Usage
Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.keycloak.Realm;
import com.pulumi.keycloak.RealmArgs;
import com.pulumi.keycloak.KeycloakFunctions;
import com.pulumi.keycloak.inputs.GetRoleArgs;
import com.pulumi.keycloak.Group;
import com.pulumi.keycloak.GroupArgs;
import com.pulumi.keycloak.GroupRoles;
import com.pulumi.keycloak.GroupRolesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var realm = new Realm("realm", RealmArgs.builder()
.realm("my-realm")
.enabled(true)
.build());
final var offlineAccess = KeycloakFunctions.getRole(GetRoleArgs.builder()
.realmId(realm.id())
.name("offline_access")
.build());
// use the data source
var group = new Group("group", GroupArgs.builder()
.realmId(realm.id())
.name("group")
.build());
var groupRoles = new GroupRoles("groupRoles", GroupRolesArgs.builder()
.realmId(realm.id())
.groupId(group.id())
.roles(offlineAccess.applyValue(getRoleResult -> getRoleResult).applyValue(offlineAccess -> offlineAccess.applyValue(getRoleResult -> getRoleResult.id())))
.build());
}
}
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
enabled: true
# use the data source
group:
type: keycloak:Group
properties:
realmId: ${realm.id}
name: group
groupRoles:
type: keycloak:GroupRoles
name: group_roles
properties:
realmId: ${realm.id}
groupId: ${group.id}
roles:
- ${offlineAccess.id}
variables:
offlineAccess:
fn::invoke:
Function: keycloak:getRole
Arguments:
realmId: ${realm.id}
name: offline_access
Argument Reference
The following arguments are supported:
realm_id
- (Required) The realm this role exists within.client_id
- (Optional) When specified, this role is assumed to be a client role belonging to the client with the provided IDname
- (Required) The name of the role
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
id
- The unique ID of the role, which can be used as an argument to other resources supported by this provider.description
- The description of the role.
Using getRole
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
function getRoleOutput(args: GetRoleOutputArgs, opts?: InvokeOptions): Output<GetRoleResult>
def get_role(client_id: Optional[str] = None,
name: Optional[str] = None,
realm_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRoleResult
def get_role_output(client_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
realm_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]
func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput
> Note: This function is named LookupRole
in the Go SDK.
public static class GetRole
{
public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
public static Output<GetRoleResult> Invoke(GetRoleInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: keycloak:index/getRole:getRole
arguments:
# arguments dictionary
The following arguments are supported:
getRole Result
The following output properties are available:
- Attributes Dictionary<string, object>
- Composite
Roles List<string> - Description string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Realm
Id string - Client
Id string
- Attributes map[string]interface{}
- Composite
Roles []string - Description string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Realm
Id string - Client
Id string
- attributes Map<String,Object>
- composite
Roles List<String> - description String
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- realm
Id String - client
Id String
- attributes {[key: string]: any}
- composite
Roles string[] - description string
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- realm
Id string - client
Id string
- attributes Mapping[str, Any]
- composite_
roles Sequence[str] - description str
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- realm_
id str - client_
id str
- attributes Map<Any>
- composite
Roles List<String> - description String
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- realm
Id String - client
Id String
Package Details
- Repository
- Keycloak pulumi/pulumi-keycloak
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
keycloak
Terraform Provider.