published on Friday, Oct 16, 2026 by Pulumi
published on Friday, Oct 16, 2026 by Pulumi
Manages a user in an AWS Directory Service directory.
Example Usage
Basic Usage
The following example assumes an existing Directory Service directory with Directory Service Data access enabled.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.directoryservicedata.User("example", {
directoryId: "d-1234567890",
samAccountName: "exampleuser",
emailAddress: "exampleuser@example.com",
givenName: "Example",
surname: "User",
});
import pulumi
import pulumi_aws as aws
example = aws.directoryservicedata.User("example",
directory_id="d-1234567890",
sam_account_name="exampleuser",
email_address="exampleuser@example.com",
given_name="Example",
surname="User")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/directoryservicedata"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := directoryservicedata.NewUser(ctx, "example", &directoryservicedata.UserArgs{
DirectoryId: pulumi.String("d-1234567890"),
SamAccountName: pulumi.String("exampleuser"),
EmailAddress: pulumi.String("exampleuser@example.com"),
GivenName: pulumi.String("Example"),
Surname: pulumi.String("User"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.DirectoryServiceData.User("example", new()
{
DirectoryId = "d-1234567890",
SamAccountName = "exampleuser",
EmailAddress = "exampleuser@example.com",
GivenName = "Example",
Surname = "User",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.directoryservicedata.User;
import com.pulumi.aws.directoryservicedata.UserArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new User("example", UserArgs.builder()
.directoryId("d-1234567890")
.samAccountName("exampleuser")
.emailAddress("exampleuser@example.com")
.givenName("Example")
.surname("User")
.build());
}
}
resources:
example:
type: aws:directoryservicedata:User
properties:
directoryId: d-1234567890
samAccountName: exampleuser
emailAddress: exampleuser@example.com
givenName: Example
surname: User
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_directoryservicedata_user" "example" {
directory_id = "d-1234567890"
sam_account_name = "exampleuser"
email_address = "exampleuser@example.com"
given_name = "Example"
surname = "User"
}
Create User Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new User(name: string, args: UserArgs, opts?: CustomResourceOptions);@overload
def User(resource_name: str,
args: UserArgs,
opts: Optional[ResourceOptions] = None)
@overload
def User(resource_name: str,
opts: Optional[ResourceOptions] = None,
directory_id: Optional[str] = None,
sam_account_name: Optional[str] = None,
email_address: Optional[str] = None,
given_name: Optional[str] = None,
region: Optional[str] = None,
surname: Optional[str] = None)func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)public User(string name, UserArgs args, CustomResourceOptions? opts = null)type: aws:directoryservicedata:User
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "aws_directoryservicedata_user" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args UserArgs
- 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 UserArgs
- 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 UserArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserArgs
- 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 exampleuserResourceResourceFromDirectoryservicedatauser = new Aws.DirectoryServiceData.User("exampleuserResourceResourceFromDirectoryservicedatauser", new()
{
DirectoryId = "string",
SamAccountName = "string",
EmailAddress = "string",
GivenName = "string",
Region = "string",
Surname = "string",
});
example, err := directoryservicedata.NewUser(ctx, "exampleuserResourceResourceFromDirectoryservicedatauser", &directoryservicedata.UserArgs{
DirectoryId: pulumi.String("string"),
SamAccountName: pulumi.String("string"),
EmailAddress: pulumi.String("string"),
GivenName: pulumi.String("string"),
Region: pulumi.String("string"),
Surname: pulumi.String("string"),
})
resource "aws_directoryservicedata_user" "exampleuserResourceResourceFromDirectoryservicedatauser" {
lifecycle {
create_before_destroy = true
}
directory_id = "string"
sam_account_name = "string"
email_address = "string"
given_name = "string"
region = "string"
surname = "string"
}
var exampleuserResourceResourceFromDirectoryservicedatauser = new com.pulumi.aws.directoryservicedata.User("exampleuserResourceResourceFromDirectoryservicedatauser", com.pulumi.aws.directoryservicedata.UserArgs.builder()
.directoryId("string")
.samAccountName("string")
.emailAddress("string")
.givenName("string")
.region("string")
.surname("string")
.build());
exampleuser_resource_resource_from_directoryservicedatauser = aws.directoryservicedata.User("exampleuserResourceResourceFromDirectoryservicedatauser",
directory_id="string",
sam_account_name="string",
email_address="string",
given_name="string",
region="string",
surname="string")
const exampleuserResourceResourceFromDirectoryservicedatauser = new aws.directoryservicedata.User("exampleuserResourceResourceFromDirectoryservicedatauser", {
directoryId: "string",
samAccountName: "string",
emailAddress: "string",
givenName: "string",
region: "string",
surname: "string",
});
type: aws:directoryservicedata:User
properties:
directoryId: string
emailAddress: string
givenName: string
region: string
samAccountName: string
surname: string
User 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 User resource accepts the following input properties:
- Directory
Id string - ID of the Directory that's associated with the user.
- Sam
Account stringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- Email
Address string - Email address of the user.
- Given
Name string - First name of the user.
- Region string
- Region where the user is managed. Defaults to the provider region.
- Surname string
- Last name of the user.
- Directory
Id string - ID of the Directory that's associated with the user.
- Sam
Account stringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- Email
Address string - Email address of the user.
- Given
Name string - First name of the user.
- Region string
- Region where the user is managed. Defaults to the provider region.
- Surname string
- Last name of the user.
- directory_
id string - ID of the Directory that's associated with the user.
- sam_
account_ stringname SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- email_
address string - Email address of the user.
- given_
name string - First name of the user.
- region string
- Region where the user is managed. Defaults to the provider region.
- surname string
- Last name of the user.
- directory
Id String - ID of the Directory that's associated with the user.
- sam
Account StringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- email
Address String - Email address of the user.
- given
Name String - First name of the user.
- region String
- Region where the user is managed. Defaults to the provider region.
- surname String
- Last name of the user.
- directory
Id string - ID of the Directory that's associated with the user.
- sam
Account stringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- email
Address string - Email address of the user.
- given
Name string - First name of the user.
- region string
- Region where the user is managed. Defaults to the provider region.
- surname string
- Last name of the user.
- directory_
id str - ID of the Directory that's associated with the user.
- sam_
account_ strname SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- email_
address str - Email address of the user.
- given_
name str - First name of the user.
- region str
- Region where the user is managed. Defaults to the provider region.
- surname str
- Last name of the user.
- directory
Id String - ID of the Directory that's associated with the user.
- sam
Account StringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- email
Address String - Email address of the user.
- given
Name String - First name of the user.
- region String
- Region where the user is managed. Defaults to the provider region.
- surname String
- Last name of the user.
Outputs
All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:
- Distinguished
Name string - Distinguished name of the user.
- Enabled bool
- Whether the user is active.
- Id string
- The provider-assigned unique ID for this managed resource.
- Realm string
- Realm of the user.
- Sid string
- Unique Security identifier (SID) of the user.
- User
Principal stringName - User principal name of the user.
- Distinguished
Name string - Distinguished name of the user.
- Enabled bool
- Whether the user is active.
- Id string
- The provider-assigned unique ID for this managed resource.
- Realm string
- Realm of the user.
- Sid string
- Unique Security identifier (SID) of the user.
- User
Principal stringName - User principal name of the user.
- distinguished_
name string - Distinguished name of the user.
- enabled bool
- Whether the user is active.
- id string
- The provider-assigned unique ID for this managed resource.
- realm string
- Realm of the user.
- sid string
- Unique Security identifier (SID) of the user.
- user_
principal_ stringname - User principal name of the user.
- distinguished
Name String - Distinguished name of the user.
- enabled Boolean
- Whether the user is active.
- id String
- The provider-assigned unique ID for this managed resource.
- realm String
- Realm of the user.
- sid String
- Unique Security identifier (SID) of the user.
- user
Principal StringName - User principal name of the user.
- distinguished
Name string - Distinguished name of the user.
- enabled boolean
- Whether the user is active.
- id string
- The provider-assigned unique ID for this managed resource.
- realm string
- Realm of the user.
- sid string
- Unique Security identifier (SID) of the user.
- user
Principal stringName - User principal name of the user.
- distinguished_
name str - Distinguished name of the user.
- enabled bool
- Whether the user is active.
- id str
- The provider-assigned unique ID for this managed resource.
- realm str
- Realm of the user.
- sid str
- Unique Security identifier (SID) of the user.
- user_
principal_ strname - User principal name of the user.
- distinguished
Name String - Distinguished name of the user.
- enabled Boolean
- Whether the user is active.
- id String
- The provider-assigned unique ID for this managed resource.
- realm String
- Realm of the user.
- sid String
- Unique Security identifier (SID) of the user.
- user
Principal StringName - User principal name of the user.
Look up Existing User Resource
Get an existing User 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?: UserState, opts?: CustomResourceOptions): User@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
directory_id: Optional[str] = None,
distinguished_name: Optional[str] = None,
email_address: Optional[str] = None,
enabled: Optional[bool] = None,
given_name: Optional[str] = None,
realm: Optional[str] = None,
region: Optional[str] = None,
sam_account_name: Optional[str] = None,
sid: Optional[str] = None,
surname: Optional[str] = None,
user_principal_name: Optional[str] = None) -> Userfunc GetUser(ctx *Context, name string, id IDInput, state *UserState, opts ...ResourceOption) (*User, error)public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)public static User get(String name, Output<String> id, UserState state, CustomResourceOptions options)resources: _: type: aws:directoryservicedata:User get: id: ${id}import {
to = aws_directoryservicedata_user.example
id = "${id}"
}
- 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.
- Directory
Id string - ID of the Directory that's associated with the user.
- Distinguished
Name string - Distinguished name of the user.
- Email
Address string - Email address of the user.
- Enabled bool
- Whether the user is active.
- Given
Name string - First name of the user.
- Realm string
- Realm of the user.
- Region string
- Region where the user is managed. Defaults to the provider region.
- Sam
Account stringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- Sid string
- Unique Security identifier (SID) of the user.
- Surname string
- Last name of the user.
- User
Principal stringName - User principal name of the user.
- Directory
Id string - ID of the Directory that's associated with the user.
- Distinguished
Name string - Distinguished name of the user.
- Email
Address string - Email address of the user.
- Enabled bool
- Whether the user is active.
- Given
Name string - First name of the user.
- Realm string
- Realm of the user.
- Region string
- Region where the user is managed. Defaults to the provider region.
- Sam
Account stringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- Sid string
- Unique Security identifier (SID) of the user.
- Surname string
- Last name of the user.
- User
Principal stringName - User principal name of the user.
- directory_
id string - ID of the Directory that's associated with the user.
- distinguished_
name string - Distinguished name of the user.
- email_
address string - Email address of the user.
- enabled bool
- Whether the user is active.
- given_
name string - First name of the user.
- realm string
- Realm of the user.
- region string
- Region where the user is managed. Defaults to the provider region.
- sam_
account_ stringname SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- sid string
- Unique Security identifier (SID) of the user.
- surname string
- Last name of the user.
- user_
principal_ stringname - User principal name of the user.
- directory
Id String - ID of the Directory that's associated with the user.
- distinguished
Name String - Distinguished name of the user.
- email
Address String - Email address of the user.
- enabled Boolean
- Whether the user is active.
- given
Name String - First name of the user.
- realm String
- Realm of the user.
- region String
- Region where the user is managed. Defaults to the provider region.
- sam
Account StringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- sid String
- Unique Security identifier (SID) of the user.
- surname String
- Last name of the user.
- user
Principal StringName - User principal name of the user.
- directory
Id string - ID of the Directory that's associated with the user.
- distinguished
Name string - Distinguished name of the user.
- email
Address string - Email address of the user.
- enabled boolean
- Whether the user is active.
- given
Name string - First name of the user.
- realm string
- Realm of the user.
- region string
- Region where the user is managed. Defaults to the provider region.
- sam
Account stringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- sid string
- Unique Security identifier (SID) of the user.
- surname string
- Last name of the user.
- user
Principal stringName - User principal name of the user.
- directory_
id str - ID of the Directory that's associated with the user.
- distinguished_
name str - Distinguished name of the user.
- email_
address str - Email address of the user.
- enabled bool
- Whether the user is active.
- given_
name str - First name of the user.
- realm str
- Realm of the user.
- region str
- Region where the user is managed. Defaults to the provider region.
- sam_
account_ strname SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- sid str
- Unique Security identifier (SID) of the user.
- surname str
- Last name of the user.
- user_
principal_ strname - User principal name of the user.
- directory
Id String - ID of the Directory that's associated with the user.
- distinguished
Name String - Distinguished name of the user.
- email
Address String - Email address of the user.
- enabled Boolean
- Whether the user is active.
- given
Name String - First name of the user.
- realm String
- Realm of the user.
- region String
- Region where the user is managed. Defaults to the provider region.
- sam
Account StringName SAM account name of the user. Must contain only word characters, hyphens, and periods.
The following arguments are optional:
- sid String
- Unique Security identifier (SID) of the user.
- surname String
- Last name of the user.
- user
Principal StringName - User principal name of the user.
Import
Identity Schema
Required
directoryId(String) ID of the Directory Service directory where the user is managed.samAccountName(String) SAM account name of the user.
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import Directory Service Data User using the directory ID and SAM account name separated by a comma. For example:
$ pulumi import aws:directoryservicedata/user:User example d-1234567890,exampleuser
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Friday, Oct 16, 2026 by Pulumi