1. Packages
  2. Auth0
  3. API Docs
  4. RolePermissions
Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi

auth0.RolePermissions

Explore with Pulumi AI

auth0 logo
Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi

    With this resource, you can manage role permissions (1-many).

    !> This resource manages all the permissions assigned to a role. In contrast, the auth0.RolePermission resource only appends a permission to a role. To avoid potential issues, it is recommended not to use this resource in conjunction with the auth0.RolePermission resource when managing permissions for the same role id.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    // Example:
    const resourceServer = new auth0.ResourceServer("resource_server", {
        name: "test",
        identifier: "test.example.com",
    });
    const resourceServerScopes = new auth0.ResourceServerScopes("resource_server_scopes", {
        resourceServerIdentifier: resourceServer.identifier,
        scopes: [
            {
                name: "store:create",
            },
            {
                name: "store:read",
            },
            {
                name: "store:update",
            },
            {
                name: "store:delete",
            },
        ],
    });
    const myRole = new auth0.Role("my_role", {name: "My Role"});
    const myRolePerms = new auth0.RolePermissions("my_role_perms", {
        permissions: resourceServer.identifier.apply(identifier => .map(entry => ({
            name: entry.value.name,
            resourceServerIdentifier: identifier,
        }))),
        roleId: myRole.id,
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    # Example:
    resource_server = auth0.ResourceServer("resource_server",
        name="test",
        identifier="test.example.com")
    resource_server_scopes = auth0.ResourceServerScopes("resource_server_scopes",
        resource_server_identifier=resource_server.identifier,
        scopes=[
            auth0.ResourceServerScopesScopeArgs(
                name="store:create",
            ),
            auth0.ResourceServerScopesScopeArgs(
                name="store:read",
            ),
            auth0.ResourceServerScopesScopeArgs(
                name="store:update",
            ),
            auth0.ResourceServerScopesScopeArgs(
                name="store:delete",
            ),
        ])
    my_role = auth0.Role("my_role", name="My Role")
    my_role_perms = auth0.RolePermissions("my_role_perms",
        permissions=resource_server.identifier.apply(lambda identifier: [{
            "name": entry["value"],
            "resourceServerIdentifier": identifier,
        } for entry in resource_server_scopes.scopes.apply(lambda scopes: [{"key": k, "value": v} for k, v in scopes])]),
        role_id=my_role.id)
    
    Coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        // Example:
        var resourceServer = new Auth0.ResourceServer("resource_server", new()
        {
            Name = "test",
            Identifier = "test.example.com",
        });
    
        var resourceServerScopes = new Auth0.ResourceServerScopes("resource_server_scopes", new()
        {
            ResourceServerIdentifier = resourceServer.Identifier,
            Scopes = new[]
            {
                new Auth0.Inputs.ResourceServerScopesScopeArgs
                {
                    Name = "store:create",
                },
                new Auth0.Inputs.ResourceServerScopesScopeArgs
                {
                    Name = "store:read",
                },
                new Auth0.Inputs.ResourceServerScopesScopeArgs
                {
                    Name = "store:update",
                },
                new Auth0.Inputs.ResourceServerScopesScopeArgs
                {
                    Name = "store:delete",
                },
            },
        });
    
        var myRole = new Auth0.Role("my_role", new()
        {
            Name = "My Role",
        });
    
        var myRolePerms = new Auth0.RolePermissions("my_role_perms", new()
        {
            Permissions = resourceServer.Identifier.Apply(identifier => ),
            RoleId = myRole.Id,
        });
    
    });
    
    Coming soon!
    
    Coming soon!
    

    Create RolePermissions Resource

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

    Constructor syntax

    new RolePermissions(name: string, args: RolePermissionsArgs, opts?: CustomResourceOptions);
    @overload
    def RolePermissions(resource_name: str,
                        args: RolePermissionsArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def RolePermissions(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        permissions: Optional[Sequence[RolePermissionsPermissionArgs]] = None,
                        role_id: Optional[str] = None)
    func NewRolePermissions(ctx *Context, name string, args RolePermissionsArgs, opts ...ResourceOption) (*RolePermissions, error)
    public RolePermissions(string name, RolePermissionsArgs args, CustomResourceOptions? opts = null)
    public RolePermissions(String name, RolePermissionsArgs args)
    public RolePermissions(String name, RolePermissionsArgs args, CustomResourceOptions options)
    
    type: auth0:RolePermissions
    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 RolePermissionsArgs
    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 RolePermissionsArgs
    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 RolePermissionsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RolePermissionsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RolePermissionsArgs
    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 rolePermissionsResource = new Auth0.RolePermissions("rolePermissionsResource", new()
    {
        Permissions = new[]
        {
            new Auth0.Inputs.RolePermissionsPermissionArgs
            {
                Name = "string",
                ResourceServerIdentifier = "string",
                Description = "string",
                ResourceServerName = "string",
            },
        },
        RoleId = "string",
    });
    
    example, err := auth0.NewRolePermissions(ctx, "rolePermissionsResource", &auth0.RolePermissionsArgs{
    	Permissions: auth0.RolePermissionsPermissionArray{
    		&auth0.RolePermissionsPermissionArgs{
    			Name:                     pulumi.String("string"),
    			ResourceServerIdentifier: pulumi.String("string"),
    			Description:              pulumi.String("string"),
    			ResourceServerName:       pulumi.String("string"),
    		},
    	},
    	RoleId: pulumi.String("string"),
    })
    
    var rolePermissionsResource = new RolePermissions("rolePermissionsResource", RolePermissionsArgs.builder()
        .permissions(RolePermissionsPermissionArgs.builder()
            .name("string")
            .resourceServerIdentifier("string")
            .description("string")
            .resourceServerName("string")
            .build())
        .roleId("string")
        .build());
    
    role_permissions_resource = auth0.RolePermissions("rolePermissionsResource",
        permissions=[auth0.RolePermissionsPermissionArgs(
            name="string",
            resource_server_identifier="string",
            description="string",
            resource_server_name="string",
        )],
        role_id="string")
    
    const rolePermissionsResource = new auth0.RolePermissions("rolePermissionsResource", {
        permissions: [{
            name: "string",
            resourceServerIdentifier: "string",
            description: "string",
            resourceServerName: "string",
        }],
        roleId: "string",
    });
    
    type: auth0:RolePermissions
    properties:
        permissions:
            - description: string
              name: string
              resourceServerIdentifier: string
              resourceServerName: string
        roleId: string
    

    RolePermissions Resource Properties

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

    Inputs

    The RolePermissions resource accepts the following input properties:

    Permissions List<RolePermissionsPermission>
    List of API permissions granted to the role.
    RoleId string
    ID of the role to associate the permission to.
    Permissions []RolePermissionsPermissionArgs
    List of API permissions granted to the role.
    RoleId string
    ID of the role to associate the permission to.
    permissions List<RolePermissionsPermission>
    List of API permissions granted to the role.
    roleId String
    ID of the role to associate the permission to.
    permissions RolePermissionsPermission[]
    List of API permissions granted to the role.
    roleId string
    ID of the role to associate the permission to.
    permissions Sequence[RolePermissionsPermissionArgs]
    List of API permissions granted to the role.
    role_id str
    ID of the role to associate the permission to.
    permissions List<Property Map>
    List of API permissions granted to the role.
    roleId String
    ID of the role to associate the permission to.

    Outputs

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

    Get an existing RolePermissions 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?: RolePermissionsState, opts?: CustomResourceOptions): RolePermissions
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            permissions: Optional[Sequence[RolePermissionsPermissionArgs]] = None,
            role_id: Optional[str] = None) -> RolePermissions
    func GetRolePermissions(ctx *Context, name string, id IDInput, state *RolePermissionsState, opts ...ResourceOption) (*RolePermissions, error)
    public static RolePermissions Get(string name, Input<string> id, RolePermissionsState? state, CustomResourceOptions? opts = null)
    public static RolePermissions get(String name, Output<String> id, RolePermissionsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Permissions List<RolePermissionsPermission>
    List of API permissions granted to the role.
    RoleId string
    ID of the role to associate the permission to.
    Permissions []RolePermissionsPermissionArgs
    List of API permissions granted to the role.
    RoleId string
    ID of the role to associate the permission to.
    permissions List<RolePermissionsPermission>
    List of API permissions granted to the role.
    roleId String
    ID of the role to associate the permission to.
    permissions RolePermissionsPermission[]
    List of API permissions granted to the role.
    roleId string
    ID of the role to associate the permission to.
    permissions Sequence[RolePermissionsPermissionArgs]
    List of API permissions granted to the role.
    role_id str
    ID of the role to associate the permission to.
    permissions List<Property Map>
    List of API permissions granted to the role.
    roleId String
    ID of the role to associate the permission to.

    Supporting Types

    RolePermissionsPermission, RolePermissionsPermissionArgs

    Name string
    Name of permission.
    ResourceServerIdentifier string
    Resource server identifier associated with the permission.
    Description string
    Description of the permission.
    ResourceServerName string
    Name of resource server that the permission is associated with.
    Name string
    Name of permission.
    ResourceServerIdentifier string
    Resource server identifier associated with the permission.
    Description string
    Description of the permission.
    ResourceServerName string
    Name of resource server that the permission is associated with.
    name String
    Name of permission.
    resourceServerIdentifier String
    Resource server identifier associated with the permission.
    description String
    Description of the permission.
    resourceServerName String
    Name of resource server that the permission is associated with.
    name string
    Name of permission.
    resourceServerIdentifier string
    Resource server identifier associated with the permission.
    description string
    Description of the permission.
    resourceServerName string
    Name of resource server that the permission is associated with.
    name str
    Name of permission.
    resource_server_identifier str
    Resource server identifier associated with the permission.
    description str
    Description of the permission.
    resource_server_name str
    Name of resource server that the permission is associated with.
    name String
    Name of permission.
    resourceServerIdentifier String
    Resource server identifier associated with the permission.
    description String
    Description of the permission.
    resourceServerName String
    Name of resource server that the permission is associated with.

    Import

    This resource can be imported by specifying the role ID

    Example:

    $ pulumi import auth0:index/rolePermissions:RolePermissions all_role_permissions "rol_XXXXXXXXXXXX"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Auth0 pulumi/pulumi-auth0
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the auth0 Terraform Provider.
    auth0 logo
    Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi