1. Packages
  2. Auth0
  3. API Docs
  4. OrganizationMemberRoles
Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi

auth0.OrganizationMemberRoles

Explore with Pulumi AI

auth0 logo
Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi

    This resource is used to manage the roles assigned to an organization member.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const reader = new auth0.Role("reader", {});
    const writer = new auth0.Role("writer", {});
    const user = new auth0.User("user", {
        connectionName: "Username-Password-Authentication",
        email: "test-user@auth0.com",
        password: "MyPass123$",
    });
    const myOrg = new auth0.Organization("myOrg", {displayName: "Some Org"});
    const myOrgMember = new auth0.OrganizationMember("myOrgMember", {
        organizationId: myOrg.id,
        userId: user.id,
    });
    const myOrgMemberRoles = new auth0.OrganizationMemberRoles("myOrgMemberRoles", {
        organizationId: myOrg.id,
        userId: user.id,
        roles: [
            reader.id,
            writer.id,
        ],
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    reader = auth0.Role("reader")
    writer = auth0.Role("writer")
    user = auth0.User("user",
        connection_name="Username-Password-Authentication",
        email="test-user@auth0.com",
        password="MyPass123$")
    my_org = auth0.Organization("myOrg", display_name="Some Org")
    my_org_member = auth0.OrganizationMember("myOrgMember",
        organization_id=my_org.id,
        user_id=user.id)
    my_org_member_roles = auth0.OrganizationMemberRoles("myOrgMemberRoles",
        organization_id=my_org.id,
        user_id=user.id,
        roles=[
            reader.id,
            writer.id,
        ])
    
    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 {
    		reader, err := auth0.NewRole(ctx, "reader", nil)
    		if err != nil {
    			return err
    		}
    		writer, err := auth0.NewRole(ctx, "writer", nil)
    		if err != nil {
    			return err
    		}
    		user, err := auth0.NewUser(ctx, "user", &auth0.UserArgs{
    			ConnectionName: pulumi.String("Username-Password-Authentication"),
    			Email:          pulumi.String("test-user@auth0.com"),
    			Password:       pulumi.String("MyPass123$"),
    		})
    		if err != nil {
    			return err
    		}
    		myOrg, err := auth0.NewOrganization(ctx, "myOrg", &auth0.OrganizationArgs{
    			DisplayName: pulumi.String("Some Org"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewOrganizationMember(ctx, "myOrgMember", &auth0.OrganizationMemberArgs{
    			OrganizationId: myOrg.ID(),
    			UserId:         user.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewOrganizationMemberRoles(ctx, "myOrgMemberRoles", &auth0.OrganizationMemberRolesArgs{
    			OrganizationId: myOrg.ID(),
    			UserId:         user.ID(),
    			Roles: pulumi.StringArray{
    				reader.ID(),
    				writer.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        var reader = new Auth0.Role("reader");
    
        var writer = new Auth0.Role("writer");
    
        var user = new Auth0.User("user", new()
        {
            ConnectionName = "Username-Password-Authentication",
            Email = "test-user@auth0.com",
            Password = "MyPass123$",
        });
    
        var myOrg = new Auth0.Organization("myOrg", new()
        {
            DisplayName = "Some Org",
        });
    
        var myOrgMember = new Auth0.OrganizationMember("myOrgMember", new()
        {
            OrganizationId = myOrg.Id,
            UserId = user.Id,
        });
    
        var myOrgMemberRoles = new Auth0.OrganizationMemberRoles("myOrgMemberRoles", new()
        {
            OrganizationId = myOrg.Id,
            UserId = user.Id,
            Roles = new[]
            {
                reader.Id,
                writer.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.Role;
    import com.pulumi.auth0.User;
    import com.pulumi.auth0.UserArgs;
    import com.pulumi.auth0.Organization;
    import com.pulumi.auth0.OrganizationArgs;
    import com.pulumi.auth0.OrganizationMember;
    import com.pulumi.auth0.OrganizationMemberArgs;
    import com.pulumi.auth0.OrganizationMemberRoles;
    import com.pulumi.auth0.OrganizationMemberRolesArgs;
    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 reader = new Role("reader");
    
            var writer = new Role("writer");
    
            var user = new User("user", UserArgs.builder()        
                .connectionName("Username-Password-Authentication")
                .email("test-user@auth0.com")
                .password("MyPass123$")
                .build());
    
            var myOrg = new Organization("myOrg", OrganizationArgs.builder()        
                .displayName("Some Org")
                .build());
    
            var myOrgMember = new OrganizationMember("myOrgMember", OrganizationMemberArgs.builder()        
                .organizationId(myOrg.id())
                .userId(user.id())
                .build());
    
            var myOrgMemberRoles = new OrganizationMemberRoles("myOrgMemberRoles", OrganizationMemberRolesArgs.builder()        
                .organizationId(myOrg.id())
                .userId(user.id())
                .roles(            
                    reader.id(),
                    writer.id())
                .build());
    
        }
    }
    
    resources:
      reader:
        type: auth0:Role
      writer:
        type: auth0:Role
      user:
        type: auth0:User
        properties:
          connectionName: Username-Password-Authentication
          email: test-user@auth0.com
          password: MyPass123$
      myOrg:
        type: auth0:Organization
        properties:
          displayName: Some Org
      myOrgMember:
        type: auth0:OrganizationMember
        properties:
          organizationId: ${myOrg.id}
          userId: ${user.id}
      myOrgMemberRoles:
        type: auth0:OrganizationMemberRoles
        properties:
          organizationId: ${myOrg.id}
          userId: ${user.id}
          roles:
            - ${reader.id}
            - ${writer.id}
    

    Create OrganizationMemberRoles Resource

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

    Constructor syntax

    new OrganizationMemberRoles(name: string, args: OrganizationMemberRolesArgs, opts?: CustomResourceOptions);
    @overload
    def OrganizationMemberRoles(resource_name: str,
                                args: OrganizationMemberRolesArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def OrganizationMemberRoles(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                organization_id: Optional[str] = None,
                                roles: Optional[Sequence[str]] = None,
                                user_id: Optional[str] = None)
    func NewOrganizationMemberRoles(ctx *Context, name string, args OrganizationMemberRolesArgs, opts ...ResourceOption) (*OrganizationMemberRoles, error)
    public OrganizationMemberRoles(string name, OrganizationMemberRolesArgs args, CustomResourceOptions? opts = null)
    public OrganizationMemberRoles(String name, OrganizationMemberRolesArgs args)
    public OrganizationMemberRoles(String name, OrganizationMemberRolesArgs args, CustomResourceOptions options)
    
    type: auth0:OrganizationMemberRoles
    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 OrganizationMemberRolesArgs
    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 OrganizationMemberRolesArgs
    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 OrganizationMemberRolesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args OrganizationMemberRolesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args OrganizationMemberRolesArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var organizationMemberRolesResource = new Auth0.OrganizationMemberRoles("organizationMemberRolesResource", new()
    {
        OrganizationId = "string",
        Roles = new[]
        {
            "string",
        },
        UserId = "string",
    });
    
    example, err := auth0.NewOrganizationMemberRoles(ctx, "organizationMemberRolesResource", &auth0.OrganizationMemberRolesArgs{
    	OrganizationId: pulumi.String("string"),
    	Roles: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	UserId: pulumi.String("string"),
    })
    
    var organizationMemberRolesResource = new OrganizationMemberRoles("organizationMemberRolesResource", OrganizationMemberRolesArgs.builder()        
        .organizationId("string")
        .roles("string")
        .userId("string")
        .build());
    
    organization_member_roles_resource = auth0.OrganizationMemberRoles("organizationMemberRolesResource",
        organization_id="string",
        roles=["string"],
        user_id="string")
    
    const organizationMemberRolesResource = new auth0.OrganizationMemberRoles("organizationMemberRolesResource", {
        organizationId: "string",
        roles: ["string"],
        userId: "string",
    });
    
    type: auth0:OrganizationMemberRoles
    properties:
        organizationId: string
        roles:
            - string
        userId: string
    

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

    OrganizationId string
    The ID of the organization.
    Roles List<string>
    The role ID(s) to assign to the organization member.
    UserId string
    The user ID of the organization member.
    OrganizationId string
    The ID of the organization.
    Roles []string
    The role ID(s) to assign to the organization member.
    UserId string
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roles List<String>
    The role ID(s) to assign to the organization member.
    userId String
    The user ID of the organization member.
    organizationId string
    The ID of the organization.
    roles string[]
    The role ID(s) to assign to the organization member.
    userId string
    The user ID of the organization member.
    organization_id str
    The ID of the organization.
    roles Sequence[str]
    The role ID(s) to assign to the organization member.
    user_id str
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roles List<String>
    The role ID(s) to assign to the organization member.
    userId String
    The user ID of the organization member.

    Outputs

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

    Get an existing OrganizationMemberRoles 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?: OrganizationMemberRolesState, opts?: CustomResourceOptions): OrganizationMemberRoles
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            organization_id: Optional[str] = None,
            roles: Optional[Sequence[str]] = None,
            user_id: Optional[str] = None) -> OrganizationMemberRoles
    func GetOrganizationMemberRoles(ctx *Context, name string, id IDInput, state *OrganizationMemberRolesState, opts ...ResourceOption) (*OrganizationMemberRoles, error)
    public static OrganizationMemberRoles Get(string name, Input<string> id, OrganizationMemberRolesState? state, CustomResourceOptions? opts = null)
    public static OrganizationMemberRoles get(String name, Output<String> id, OrganizationMemberRolesState 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:
    OrganizationId string
    The ID of the organization.
    Roles List<string>
    The role ID(s) to assign to the organization member.
    UserId string
    The user ID of the organization member.
    OrganizationId string
    The ID of the organization.
    Roles []string
    The role ID(s) to assign to the organization member.
    UserId string
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roles List<String>
    The role ID(s) to assign to the organization member.
    userId String
    The user ID of the organization member.
    organizationId string
    The ID of the organization.
    roles string[]
    The role ID(s) to assign to the organization member.
    userId string
    The user ID of the organization member.
    organization_id str
    The ID of the organization.
    roles Sequence[str]
    The role ID(s) to assign to the organization member.
    user_id str
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roles List<String>
    The role ID(s) to assign to the organization member.
    userId String
    The user ID of the organization member.

    Import

    This resource can be imported by specifying the

    organization ID and user ID separated by “::” (note the double colon)

    ::

    Example:

    $ pulumi import auth0:index/organizationMemberRoles:OrganizationMemberRoles my_org_member_roles "org_XXXXX::auth0|XXXXX"
    

    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.3.1 published on Thursday, Mar 14, 2024 by Pulumi