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

auth0.OrganizationMembers

Explore with Pulumi AI

This resource is used to manage members of an organization.

!> This resource manages all the members assigned to an organization. In contrast, the auth0.OrganizationMember resource only appends a member to an organization. To avoid potential issues, it is recommended not to use this resource in conjunction with the auth0.OrganizationMember resource when managing members for the same organization id.

Example Usage

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

const user1 = new auth0.User("user_1", {
    connectionName: "Username-Password-Authentication",
    email: "myuser1@auth0.com",
    password: "MyPass123$",
});
const user2 = new auth0.User("user_2", {
    connectionName: "Username-Password-Authentication",
    email: "myuser2@auth0.com",
    password: "MyPass123$",
});
const myOrg = new auth0.Organization("my_org", {
    name: "some-org",
    displayName: "Some Organization",
});
const myMembers = new auth0.OrganizationMembers("my_members", {
    organizationId: myOrg.id,
    members: [
        user1.id,
        user2.id,
    ],
});
Copy
import pulumi
import pulumi_auth0 as auth0

user1 = auth0.User("user_1",
    connection_name="Username-Password-Authentication",
    email="myuser1@auth0.com",
    password="MyPass123$")
user2 = auth0.User("user_2",
    connection_name="Username-Password-Authentication",
    email="myuser2@auth0.com",
    password="MyPass123$")
my_org = auth0.Organization("my_org",
    name="some-org",
    display_name="Some Organization")
my_members = auth0.OrganizationMembers("my_members",
    organization_id=my_org.id,
    members=[
        user1.id,
        user2.id,
    ])
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 {
		user1, err := auth0.NewUser(ctx, "user_1", &auth0.UserArgs{
			ConnectionName: pulumi.String("Username-Password-Authentication"),
			Email:          pulumi.String("myuser1@auth0.com"),
			Password:       pulumi.String("MyPass123$"),
		})
		if err != nil {
			return err
		}
		user2, err := auth0.NewUser(ctx, "user_2", &auth0.UserArgs{
			ConnectionName: pulumi.String("Username-Password-Authentication"),
			Email:          pulumi.String("myuser2@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 Organization"),
		})
		if err != nil {
			return err
		}
		_, err = auth0.NewOrganizationMembers(ctx, "my_members", &auth0.OrganizationMembersArgs{
			OrganizationId: myOrg.ID(),
			Members: pulumi.StringArray{
				user1.ID(),
				user2.ID(),
			},
		})
		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(() => 
{
    var user1 = new Auth0.User("user_1", new()
    {
        ConnectionName = "Username-Password-Authentication",
        Email = "myuser1@auth0.com",
        Password = "MyPass123$",
    });

    var user2 = new Auth0.User("user_2", new()
    {
        ConnectionName = "Username-Password-Authentication",
        Email = "myuser2@auth0.com",
        Password = "MyPass123$",
    });

    var myOrg = new Auth0.Organization("my_org", new()
    {
        Name = "some-org",
        DisplayName = "Some Organization",
    });

    var myMembers = new Auth0.OrganizationMembers("my_members", new()
    {
        OrganizationId = myOrg.Id,
        Members = new[]
        {
            user1.Id,
            user2.Id,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.auth0.User;
import com.pulumi.auth0.UserArgs;
import com.pulumi.auth0.Organization;
import com.pulumi.auth0.OrganizationArgs;
import com.pulumi.auth0.OrganizationMembers;
import com.pulumi.auth0.OrganizationMembersArgs;
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 user1 = new User("user1", UserArgs.builder()
            .connectionName("Username-Password-Authentication")
            .email("myuser1@auth0.com")
            .password("MyPass123$")
            .build());

        var user2 = new User("user2", UserArgs.builder()
            .connectionName("Username-Password-Authentication")
            .email("myuser2@auth0.com")
            .password("MyPass123$")
            .build());

        var myOrg = new Organization("myOrg", OrganizationArgs.builder()
            .name("some-org")
            .displayName("Some Organization")
            .build());

        var myMembers = new OrganizationMembers("myMembers", OrganizationMembersArgs.builder()
            .organizationId(myOrg.id())
            .members(            
                user1.id(),
                user2.id())
            .build());

    }
}
Copy
resources:
  user1:
    type: auth0:User
    name: user_1
    properties:
      connectionName: Username-Password-Authentication
      email: myuser1@auth0.com
      password: MyPass123$
  user2:
    type: auth0:User
    name: user_2
    properties:
      connectionName: Username-Password-Authentication
      email: myuser2@auth0.com
      password: MyPass123$
  myOrg:
    type: auth0:Organization
    name: my_org
    properties:
      name: some-org
      displayName: Some Organization
  myMembers:
    type: auth0:OrganizationMembers
    name: my_members
    properties:
      organizationId: ${myOrg.id}
      members:
        - ${user1.id}
        - ${user2.id}
Copy

Create OrganizationMembers Resource

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

Constructor syntax

new OrganizationMembers(name: string, args: OrganizationMembersArgs, opts?: CustomResourceOptions);
@overload
def OrganizationMembers(resource_name: str,
                        args: OrganizationMembersArgs,
                        opts: Optional[ResourceOptions] = None)

@overload
def OrganizationMembers(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        members: Optional[Sequence[str]] = None,
                        organization_id: Optional[str] = None)
func NewOrganizationMembers(ctx *Context, name string, args OrganizationMembersArgs, opts ...ResourceOption) (*OrganizationMembers, error)
public OrganizationMembers(string name, OrganizationMembersArgs args, CustomResourceOptions? opts = null)
public OrganizationMembers(String name, OrganizationMembersArgs args)
public OrganizationMembers(String name, OrganizationMembersArgs args, CustomResourceOptions options)
type: auth0:OrganizationMembers
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. OrganizationMembersArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. OrganizationMembersArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. OrganizationMembersArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. OrganizationMembersArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. OrganizationMembersArgs
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 organizationMembersResource = new Auth0.OrganizationMembers("organizationMembersResource", new()
{
    Members = new[]
    {
        "string",
    },
    OrganizationId = "string",
});
Copy
example, err := auth0.NewOrganizationMembers(ctx, "organizationMembersResource", &auth0.OrganizationMembersArgs{
	Members: pulumi.StringArray{
		pulumi.String("string"),
	},
	OrganizationId: pulumi.String("string"),
})
Copy
var organizationMembersResource = new OrganizationMembers("organizationMembersResource", OrganizationMembersArgs.builder()
    .members("string")
    .organizationId("string")
    .build());
Copy
organization_members_resource = auth0.OrganizationMembers("organizationMembersResource",
    members=["string"],
    organization_id="string")
Copy
const organizationMembersResource = new auth0.OrganizationMembers("organizationMembersResource", {
    members: ["string"],
    organizationId: "string",
});
Copy
type: auth0:OrganizationMembers
properties:
    members:
        - string
    organizationId: string
Copy

OrganizationMembers Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The OrganizationMembers resource accepts the following input properties:

Members This property is required. List<string>
Add user ID(s) directly from the tenant to become members of the organization.
OrganizationId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the organization to assign the members to.
Members This property is required. []string
Add user ID(s) directly from the tenant to become members of the organization.
OrganizationId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the organization to assign the members to.
members This property is required. List<String>
Add user ID(s) directly from the tenant to become members of the organization.
organizationId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the organization to assign the members to.
members This property is required. string[]
Add user ID(s) directly from the tenant to become members of the organization.
organizationId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the organization to assign the members to.
members This property is required. Sequence[str]
Add user ID(s) directly from the tenant to become members of the organization.
organization_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the organization to assign the members to.
members This property is required. List<String>
Add user ID(s) directly from the tenant to become members of the organization.
organizationId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the organization to assign the members to.

Outputs

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

Get an existing OrganizationMembers 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?: OrganizationMembersState, opts?: CustomResourceOptions): OrganizationMembers
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        members: Optional[Sequence[str]] = None,
        organization_id: Optional[str] = None) -> OrganizationMembers
func GetOrganizationMembers(ctx *Context, name string, id IDInput, state *OrganizationMembersState, opts ...ResourceOption) (*OrganizationMembers, error)
public static OrganizationMembers Get(string name, Input<string> id, OrganizationMembersState? state, CustomResourceOptions? opts = null)
public static OrganizationMembers get(String name, Output<String> id, OrganizationMembersState state, CustomResourceOptions options)
resources:  _:    type: auth0:OrganizationMembers    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Members List<string>
Add user ID(s) directly from the tenant to become members of the organization.
OrganizationId Changes to this property will trigger replacement. string
The ID of the organization to assign the members to.
Members []string
Add user ID(s) directly from the tenant to become members of the organization.
OrganizationId Changes to this property will trigger replacement. string
The ID of the organization to assign the members to.
members List<String>
Add user ID(s) directly from the tenant to become members of the organization.
organizationId Changes to this property will trigger replacement. String
The ID of the organization to assign the members to.
members string[]
Add user ID(s) directly from the tenant to become members of the organization.
organizationId Changes to this property will trigger replacement. string
The ID of the organization to assign the members to.
members Sequence[str]
Add user ID(s) directly from the tenant to become members of the organization.
organization_id Changes to this property will trigger replacement. str
The ID of the organization to assign the members to.
members List<String>
Add user ID(s) directly from the tenant to become members of the organization.
organizationId Changes to this property will trigger replacement. String
The ID of the organization to assign the members to.

Import

This resource can be imported by specifying the organization ID.

Example:

$ pulumi import auth0:index/organizationMembers:OrganizationMembers my_org_members "org_XXXXX"
Copy

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.