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

auth0.OrganizationMemberRole

Explore with Pulumi AI

auth0 logo
Auth0 v3.4.0 published on Wednesday, Jun 19, 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", {name: "Reader"});
    const writer = new auth0.Role("writer", {name: "Writer"});
    const user = new auth0.User("user", {
        connectionName: "Username-Password-Authentication",
        email: "test-user@auth0.com",
        password: "MyPass123$",
    });
    const myOrg = new auth0.Organization("my_org", {
        name: "some-org",
        displayName: "Some Org",
    });
    const myOrgMember = new auth0.OrganizationMember("my_org_member", {
        organizationId: myOrg.id,
        userId: user.id,
    });
    const role1 = new auth0.OrganizationMemberRole("role1", {
        organizationId: myOrg.id,
        userId: user.id,
        roleId: reader.id,
    });
    const role2 = new auth0.OrganizationMemberRole("role2", {
        organizationId: myOrg.id,
        userId: user.id,
        roleId: writer.id,
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    reader = auth0.Role("reader", name="Reader")
    writer = auth0.Role("writer", name="Writer")
    user = auth0.User("user",
        connection_name="Username-Password-Authentication",
        email="test-user@auth0.com",
        password="MyPass123$")
    my_org = auth0.Organization("my_org",
        name="some-org",
        display_name="Some Org")
    my_org_member = auth0.OrganizationMember("my_org_member",
        organization_id=my_org.id,
        user_id=user.id)
    role1 = auth0.OrganizationMemberRole("role1",
        organization_id=my_org.id,
        user_id=user.id,
        role_id=reader.id)
    role2 = auth0.OrganizationMemberRole("role2",
        organization_id=my_org.id,
        user_id=user.id,
        role_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", &auth0.RoleArgs{
    			Name: pulumi.String("Reader"),
    		})
    		if err != nil {
    			return err
    		}
    		writer, err := auth0.NewRole(ctx, "writer", &auth0.RoleArgs{
    			Name: pulumi.String("Writer"),
    		})
    		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, "my_org", &auth0.OrganizationArgs{
    			Name:        pulumi.String("some-org"),
    			DisplayName: pulumi.String("Some Org"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewOrganizationMember(ctx, "my_org_member", &auth0.OrganizationMemberArgs{
    			OrganizationId: myOrg.ID(),
    			UserId:         user.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewOrganizationMemberRole(ctx, "role1", &auth0.OrganizationMemberRoleArgs{
    			OrganizationId: myOrg.ID(),
    			UserId:         user.ID(),
    			RoleId:         reader.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewOrganizationMemberRole(ctx, "role2", &auth0.OrganizationMemberRoleArgs{
    			OrganizationId: myOrg.ID(),
    			UserId:         user.ID(),
    			RoleId:         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", new()
        {
            Name = "Reader",
        });
    
        var writer = new Auth0.Role("writer", new()
        {
            Name = "Writer",
        });
    
        var user = new Auth0.User("user", new()
        {
            ConnectionName = "Username-Password-Authentication",
            Email = "test-user@auth0.com",
            Password = "MyPass123$",
        });
    
        var myOrg = new Auth0.Organization("my_org", new()
        {
            Name = "some-org",
            DisplayName = "Some Org",
        });
    
        var myOrgMember = new Auth0.OrganizationMember("my_org_member", new()
        {
            OrganizationId = myOrg.Id,
            UserId = user.Id,
        });
    
        var role1 = new Auth0.OrganizationMemberRole("role1", new()
        {
            OrganizationId = myOrg.Id,
            UserId = user.Id,
            RoleId = reader.Id,
        });
    
        var role2 = new Auth0.OrganizationMemberRole("role2", new()
        {
            OrganizationId = myOrg.Id,
            UserId = user.Id,
            RoleId = 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.RoleArgs;
    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.OrganizationMemberRole;
    import com.pulumi.auth0.OrganizationMemberRoleArgs;
    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", RoleArgs.builder()
                .name("Reader")
                .build());
    
            var writer = new Role("writer", RoleArgs.builder()
                .name("Writer")
                .build());
    
            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()
                .name("some-org")
                .displayName("Some Org")
                .build());
    
            var myOrgMember = new OrganizationMember("myOrgMember", OrganizationMemberArgs.builder()
                .organizationId(myOrg.id())
                .userId(user.id())
                .build());
    
            var role1 = new OrganizationMemberRole("role1", OrganizationMemberRoleArgs.builder()
                .organizationId(myOrg.id())
                .userId(user.id())
                .roleId(reader.id())
                .build());
    
            var role2 = new OrganizationMemberRole("role2", OrganizationMemberRoleArgs.builder()
                .organizationId(myOrg.id())
                .userId(user.id())
                .roleId(writer.id())
                .build());
    
        }
    }
    
    resources:
      reader:
        type: auth0:Role
        properties:
          name: Reader
      writer:
        type: auth0:Role
        properties:
          name: Writer
      user:
        type: auth0:User
        properties:
          connectionName: Username-Password-Authentication
          email: test-user@auth0.com
          password: MyPass123$
      myOrg:
        type: auth0:Organization
        name: my_org
        properties:
          name: some-org
          displayName: Some Org
      myOrgMember:
        type: auth0:OrganizationMember
        name: my_org_member
        properties:
          organizationId: ${myOrg.id}
          userId: ${user.id}
      role1:
        type: auth0:OrganizationMemberRole
        properties:
          organizationId: ${myOrg.id}
          userId: ${user.id}
          roleId: ${reader.id}
      role2:
        type: auth0:OrganizationMemberRole
        properties:
          organizationId: ${myOrg.id}
          userId: ${user.id}
          roleId: ${writer.id}
    

    Create OrganizationMemberRole Resource

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

    Constructor syntax

    new OrganizationMemberRole(name: string, args: OrganizationMemberRoleArgs, opts?: CustomResourceOptions);
    @overload
    def OrganizationMemberRole(resource_name: str,
                               args: OrganizationMemberRoleArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def OrganizationMemberRole(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               organization_id: Optional[str] = None,
                               role_id: Optional[str] = None,
                               user_id: Optional[str] = None)
    func NewOrganizationMemberRole(ctx *Context, name string, args OrganizationMemberRoleArgs, opts ...ResourceOption) (*OrganizationMemberRole, error)
    public OrganizationMemberRole(string name, OrganizationMemberRoleArgs args, CustomResourceOptions? opts = null)
    public OrganizationMemberRole(String name, OrganizationMemberRoleArgs args)
    public OrganizationMemberRole(String name, OrganizationMemberRoleArgs args, CustomResourceOptions options)
    
    type: auth0:OrganizationMemberRole
    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 OrganizationMemberRoleArgs
    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 OrganizationMemberRoleArgs
    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 OrganizationMemberRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args OrganizationMemberRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args OrganizationMemberRoleArgs
    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 organizationMemberRoleResource = new Auth0.OrganizationMemberRole("organizationMemberRoleResource", new()
    {
        OrganizationId = "string",
        RoleId = "string",
        UserId = "string",
    });
    
    example, err := auth0.NewOrganizationMemberRole(ctx, "organizationMemberRoleResource", &auth0.OrganizationMemberRoleArgs{
    	OrganizationId: pulumi.String("string"),
    	RoleId:         pulumi.String("string"),
    	UserId:         pulumi.String("string"),
    })
    
    var organizationMemberRoleResource = new OrganizationMemberRole("organizationMemberRoleResource", OrganizationMemberRoleArgs.builder()
        .organizationId("string")
        .roleId("string")
        .userId("string")
        .build());
    
    organization_member_role_resource = auth0.OrganizationMemberRole("organizationMemberRoleResource",
        organization_id="string",
        role_id="string",
        user_id="string")
    
    const organizationMemberRoleResource = new auth0.OrganizationMemberRole("organizationMemberRoleResource", {
        organizationId: "string",
        roleId: "string",
        userId: "string",
    });
    
    type: auth0:OrganizationMemberRole
    properties:
        organizationId: string
        roleId: string
        userId: string
    

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

    OrganizationId string
    The ID of the organization.
    RoleId string
    The role ID to assign to the organization member.
    UserId string
    The user ID of the organization member.
    OrganizationId string
    The ID of the organization.
    RoleId string
    The role ID to assign to the organization member.
    UserId string
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roleId String
    The role ID to assign to the organization member.
    userId String
    The user ID of the organization member.
    organizationId string
    The ID of the organization.
    roleId string
    The role ID to assign to the organization member.
    userId string
    The user ID of the organization member.
    organization_id str
    The ID of the organization.
    role_id str
    The role ID to assign to the organization member.
    user_id str
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roleId String
    The role ID 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 OrganizationMemberRole resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    RoleDescription string
    Description of the role.
    RoleName string
    Name of the role.
    Id string
    The provider-assigned unique ID for this managed resource.
    RoleDescription string
    Description of the role.
    RoleName string
    Name of the role.
    id String
    The provider-assigned unique ID for this managed resource.
    roleDescription String
    Description of the role.
    roleName String
    Name of the role.
    id string
    The provider-assigned unique ID for this managed resource.
    roleDescription string
    Description of the role.
    roleName string
    Name of the role.
    id str
    The provider-assigned unique ID for this managed resource.
    role_description str
    Description of the role.
    role_name str
    Name of the role.
    id String
    The provider-assigned unique ID for this managed resource.
    roleDescription String
    Description of the role.
    roleName String
    Name of the role.

    Look up Existing OrganizationMemberRole Resource

    Get an existing OrganizationMemberRole 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?: OrganizationMemberRoleState, opts?: CustomResourceOptions): OrganizationMemberRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            organization_id: Optional[str] = None,
            role_description: Optional[str] = None,
            role_id: Optional[str] = None,
            role_name: Optional[str] = None,
            user_id: Optional[str] = None) -> OrganizationMemberRole
    func GetOrganizationMemberRole(ctx *Context, name string, id IDInput, state *OrganizationMemberRoleState, opts ...ResourceOption) (*OrganizationMemberRole, error)
    public static OrganizationMemberRole Get(string name, Input<string> id, OrganizationMemberRoleState? state, CustomResourceOptions? opts = null)
    public static OrganizationMemberRole get(String name, Output<String> id, OrganizationMemberRoleState 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.
    RoleDescription string
    Description of the role.
    RoleId string
    The role ID to assign to the organization member.
    RoleName string
    Name of the role.
    UserId string
    The user ID of the organization member.
    OrganizationId string
    The ID of the organization.
    RoleDescription string
    Description of the role.
    RoleId string
    The role ID to assign to the organization member.
    RoleName string
    Name of the role.
    UserId string
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roleDescription String
    Description of the role.
    roleId String
    The role ID to assign to the organization member.
    roleName String
    Name of the role.
    userId String
    The user ID of the organization member.
    organizationId string
    The ID of the organization.
    roleDescription string
    Description of the role.
    roleId string
    The role ID to assign to the organization member.
    roleName string
    Name of the role.
    userId string
    The user ID of the organization member.
    organization_id str
    The ID of the organization.
    role_description str
    Description of the role.
    role_id str
    The role ID to assign to the organization member.
    role_name str
    Name of the role.
    user_id str
    The user ID of the organization member.
    organizationId String
    The ID of the organization.
    roleDescription String
    Description of the role.
    roleId String
    The role ID to assign to the organization member.
    roleName String
    Name of the role.
    userId String
    The user ID of the organization member.

    Import

    This resource can be imported by specifying the

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

    ::::

    Example:

    $ pulumi import auth0:index/organizationMemberRole:OrganizationMemberRole my_org_member_role "org_XXXXX::auth0|XXXXX::role_XXXX"
    

    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