1. Packages
  2. Auth0 Provider
  3. API Docs
  4. getRole
Auth0 v3.17.1 published on Tuesday, Apr 15, 2025 by Pulumi

auth0.getRole

Explore with Pulumi AI

Auth0 v3.17.1 published on Tuesday, Apr 15, 2025 by Pulumi

Data source to retrieve a specific Auth0 role by role_id or name.

Example Usage

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

// An Auth0 Role loaded using its name.
const some_role_by_name = auth0.getRole({
    name: "my-role",
});
// An Auth0 Role loaded using its ID.
const some_role_by_id = auth0.getRole({
    roleId: "abcdefghkijklmnopqrstuvwxyz0123456789",
});
Copy
import pulumi
import pulumi_auth0 as auth0

# An Auth0 Role loaded using its name.
some_role_by_name = auth0.get_role(name="my-role")
# An Auth0 Role loaded using its ID.
some_role_by_id = auth0.get_role(role_id="abcdefghkijklmnopqrstuvwxyz0123456789")
Copy
package main

import (
	"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// An Auth0 Role loaded using its name.
		_, err := auth0.LookupRole(ctx, &auth0.LookupRoleArgs{
			Name: pulumi.StringRef("my-role"),
		}, nil)
		if err != nil {
			return err
		}
		// An Auth0 Role loaded using its ID.
		_, err = auth0.LookupRole(ctx, &auth0.LookupRoleArgs{
			RoleId: pulumi.StringRef("abcdefghkijklmnopqrstuvwxyz0123456789"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Auth0 = Pulumi.Auth0;

return await Deployment.RunAsync(() => 
{
    // An Auth0 Role loaded using its name.
    var some_role_by_name = Auth0.GetRole.Invoke(new()
    {
        Name = "my-role",
    });

    // An Auth0 Role loaded using its ID.
    var some_role_by_id = Auth0.GetRole.Invoke(new()
    {
        RoleId = "abcdefghkijklmnopqrstuvwxyz0123456789",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.auth0.Auth0Functions;
import com.pulumi.auth0.inputs.GetRoleArgs;
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) {
        // An Auth0 Role loaded using its name.
        final var some-role-by-name = Auth0Functions.getRole(GetRoleArgs.builder()
            .name("my-role")
            .build());

        // An Auth0 Role loaded using its ID.
        final var some-role-by-id = Auth0Functions.getRole(GetRoleArgs.builder()
            .roleId("abcdefghkijklmnopqrstuvwxyz0123456789")
            .build());

    }
}
Copy
variables:
  # An Auth0 Role loaded using its name.
  some-role-by-name:
    fn::invoke:
      function: auth0:getRole
      arguments:
        name: my-role
  # An Auth0 Role loaded using its ID.
  some-role-by-id:
    fn::invoke:
      function: auth0:getRole
      arguments:
        roleId: abcdefghkijklmnopqrstuvwxyz0123456789
Copy

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>
Copy
def get_role(name: Optional[str] = None,
             role_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetRoleResult
def get_role_output(name: Optional[pulumi.Input[str]] = None,
             role_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]
Copy
func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
public static Output<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: auth0:index/getRole:getRole
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name string
The name of the role. If not provided, role_id must be set.
RoleId string
The ID of the role. If not provided, name must be set.
Name string
The name of the role. If not provided, role_id must be set.
RoleId string
The ID of the role. If not provided, name must be set.
name String
The name of the role. If not provided, role_id must be set.
roleId String
The ID of the role. If not provided, name must be set.
name string
The name of the role. If not provided, role_id must be set.
roleId string
The ID of the role. If not provided, name must be set.
name str
The name of the role. If not provided, role_id must be set.
role_id str
The ID of the role. If not provided, name must be set.
name String
The name of the role. If not provided, role_id must be set.
roleId String
The ID of the role. If not provided, name must be set.

getRole Result

The following output properties are available:

Description string
The description of the role.
Id string
The provider-assigned unique ID for this managed resource.
Permissions List<GetRolePermission>
Configuration settings for permissions (scopes) attached to the role.
Users List<string>
List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
Name string
The name of the role. If not provided, role_id must be set.
RoleId string
The ID of the role. If not provided, name must be set.
Description string
The description of the role.
Id string
The provider-assigned unique ID for this managed resource.
Permissions []GetRolePermissionType
Configuration settings for permissions (scopes) attached to the role.
Users []string
List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
Name string
The name of the role. If not provided, role_id must be set.
RoleId string
The ID of the role. If not provided, name must be set.
description String
The description of the role.
id String
The provider-assigned unique ID for this managed resource.
permissions List<GetRolePermission>
Configuration settings for permissions (scopes) attached to the role.
users List<String>
List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
name String
The name of the role. If not provided, role_id must be set.
roleId String
The ID of the role. If not provided, name must be set.
description string
The description of the role.
id string
The provider-assigned unique ID for this managed resource.
permissions GetRolePermission[]
Configuration settings for permissions (scopes) attached to the role.
users string[]
List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
name string
The name of the role. If not provided, role_id must be set.
roleId string
The ID of the role. If not provided, name must be set.
description str
The description of the role.
id str
The provider-assigned unique ID for this managed resource.
permissions Sequence[GetRolePermission]
Configuration settings for permissions (scopes) attached to the role.
users Sequence[str]
List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
name str
The name of the role. If not provided, role_id must be set.
role_id str
The ID of the role. If not provided, name must be set.
description String
The description of the role.
id String
The provider-assigned unique ID for this managed resource.
permissions List<Property Map>
Configuration settings for permissions (scopes) attached to the role.
users List<String>
List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
name String
The name of the role. If not provided, role_id must be set.
roleId String
The ID of the role. If not provided, name must be set.

Supporting Types

GetRolePermission

Description This property is required. string
Description of the permission.
Name This property is required. string
Name of the permission (scope) configured on the resource server (API).
ResourceServerIdentifier This property is required. string
Unique identifier for the resource server (API).
ResourceServerName This property is required. string
Name of resource server (API) that the permission is associated with.
Description This property is required. string
Description of the permission.
Name This property is required. string
Name of the permission (scope) configured on the resource server (API).
ResourceServerIdentifier This property is required. string
Unique identifier for the resource server (API).
ResourceServerName This property is required. string
Name of resource server (API) that the permission is associated with.
description This property is required. String
Description of the permission.
name This property is required. String
Name of the permission (scope) configured on the resource server (API).
resourceServerIdentifier This property is required. String
Unique identifier for the resource server (API).
resourceServerName This property is required. String
Name of resource server (API) that the permission is associated with.
description This property is required. string
Description of the permission.
name This property is required. string
Name of the permission (scope) configured on the resource server (API).
resourceServerIdentifier This property is required. string
Unique identifier for the resource server (API).
resourceServerName This property is required. string
Name of resource server (API) that the permission is associated with.
description This property is required. str
Description of the permission.
name This property is required. str
Name of the permission (scope) configured on the resource server (API).
resource_server_identifier This property is required. str
Unique identifier for the resource server (API).
resource_server_name This property is required. str
Name of resource server (API) that the permission is associated with.
description This property is required. String
Description of the permission.
name This property is required. String
Name of the permission (scope) configured on the resource server (API).
resourceServerIdentifier This property is required. String
Unique identifier for the resource server (API).
resourceServerName This property is required. String
Name of resource server (API) that the permission is associated with.

Package Details

Repository
Auth0 pulumi/pulumi-auth0
License
Apache-2.0
Notes
This Pulumi package is based on the auth0 Terraform Provider.
Auth0 v3.17.1 published on Tuesday, Apr 15, 2025 by Pulumi