1. Packages
  2. HashiCorp Vault Provider
  3. API Docs
  4. ldap
  5. AuthBackendUser
HashiCorp Vault v6.6.0 published on Thursday, Mar 13, 2025 by Pulumi

vault.ldap.AuthBackendUser

Explore with Pulumi AI

Provides a resource to create a user in an LDAP auth backend within Vault.

Example Usage

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

const ldap = new vault.ldap.AuthBackend("ldap", {
    path: "ldap",
    url: "ldaps://dc-01.example.org",
    userdn: "OU=Users,OU=Accounts,DC=example,DC=org",
    userattr: "sAMAccountName",
    upndomain: "EXAMPLE.ORG",
    discoverdn: false,
    groupdn: "OU=Groups,DC=example,DC=org",
    groupfilter: "(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))",
});
const user = new vault.ldap.AuthBackendUser("user", {
    username: "test-user",
    policies: [
        "dba",
        "sysops",
    ],
    backend: ldap.path,
});
Copy
import pulumi
import pulumi_vault as vault

ldap = vault.ldap.AuthBackend("ldap",
    path="ldap",
    url="ldaps://dc-01.example.org",
    userdn="OU=Users,OU=Accounts,DC=example,DC=org",
    userattr="sAMAccountName",
    upndomain="EXAMPLE.ORG",
    discoverdn=False,
    groupdn="OU=Groups,DC=example,DC=org",
    groupfilter="(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))")
user = vault.ldap.AuthBackendUser("user",
    username="test-user",
    policies=[
        "dba",
        "sysops",
    ],
    backend=ldap.path)
Copy
package main

import (
	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/ldap"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ldap, err := ldap.NewAuthBackend(ctx, "ldap", &ldap.AuthBackendArgs{
			Path:        pulumi.String("ldap"),
			Url:         pulumi.String("ldaps://dc-01.example.org"),
			Userdn:      pulumi.String("OU=Users,OU=Accounts,DC=example,DC=org"),
			Userattr:    pulumi.String("sAMAccountName"),
			Upndomain:   pulumi.String("EXAMPLE.ORG"),
			Discoverdn:  pulumi.Bool(false),
			Groupdn:     pulumi.String("OU=Groups,DC=example,DC=org"),
			Groupfilter: pulumi.String("(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))"),
		})
		if err != nil {
			return err
		}
		_, err = ldap.NewAuthBackendUser(ctx, "user", &ldap.AuthBackendUserArgs{
			Username: pulumi.String("test-user"),
			Policies: pulumi.StringArray{
				pulumi.String("dba"),
				pulumi.String("sysops"),
			},
			Backend: ldap.Path,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;

return await Deployment.RunAsync(() => 
{
    var ldap = new Vault.Ldap.AuthBackend("ldap", new()
    {
        Path = "ldap",
        Url = "ldaps://dc-01.example.org",
        Userdn = "OU=Users,OU=Accounts,DC=example,DC=org",
        Userattr = "sAMAccountName",
        Upndomain = "EXAMPLE.ORG",
        Discoverdn = false,
        Groupdn = "OU=Groups,DC=example,DC=org",
        Groupfilter = "(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))",
    });

    var user = new Vault.Ldap.AuthBackendUser("user", new()
    {
        Username = "test-user",
        Policies = new[]
        {
            "dba",
            "sysops",
        },
        Backend = ldap.Path,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.ldap.AuthBackend;
import com.pulumi.vault.ldap.AuthBackendArgs;
import com.pulumi.vault.ldap.AuthBackendUser;
import com.pulumi.vault.ldap.AuthBackendUserArgs;
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 ldap = new AuthBackend("ldap", AuthBackendArgs.builder()
            .path("ldap")
            .url("ldaps://dc-01.example.org")
            .userdn("OU=Users,OU=Accounts,DC=example,DC=org")
            .userattr("sAMAccountName")
            .upndomain("EXAMPLE.ORG")
            .discoverdn(false)
            .groupdn("OU=Groups,DC=example,DC=org")
            .groupfilter("(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))")
            .build());

        var user = new AuthBackendUser("user", AuthBackendUserArgs.builder()
            .username("test-user")
            .policies(            
                "dba",
                "sysops")
            .backend(ldap.path())
            .build());

    }
}
Copy
resources:
  ldap:
    type: vault:ldap:AuthBackend
    properties:
      path: ldap
      url: ldaps://dc-01.example.org
      userdn: OU=Users,OU=Accounts,DC=example,DC=org
      userattr: sAMAccountName
      upndomain: EXAMPLE.ORG
      discoverdn: false
      groupdn: OU=Groups,DC=example,DC=org
      groupfilter: (&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))
  user:
    type: vault:ldap:AuthBackendUser
    properties:
      username: test-user
      policies:
        - dba
        - sysops
      backend: ${ldap.path}
Copy

Create AuthBackendUser Resource

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

Constructor syntax

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

@overload
def AuthBackendUser(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    username: Optional[str] = None,
                    backend: Optional[str] = None,
                    groups: Optional[Sequence[str]] = None,
                    namespace: Optional[str] = None,
                    policies: Optional[Sequence[str]] = None)
func NewAuthBackendUser(ctx *Context, name string, args AuthBackendUserArgs, opts ...ResourceOption) (*AuthBackendUser, error)
public AuthBackendUser(string name, AuthBackendUserArgs args, CustomResourceOptions? opts = null)
public AuthBackendUser(String name, AuthBackendUserArgs args)
public AuthBackendUser(String name, AuthBackendUserArgs args, CustomResourceOptions options)
type: vault:ldap:AuthBackendUser
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. AuthBackendUserArgs
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. AuthBackendUserArgs
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. AuthBackendUserArgs
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. AuthBackendUserArgs
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. AuthBackendUserArgs
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 authBackendUserResource = new Vault.Ldap.AuthBackendUser("authBackendUserResource", new()
{
    Username = "string",
    Backend = "string",
    Groups = new[]
    {
        "string",
    },
    Namespace = "string",
    Policies = new[]
    {
        "string",
    },
});
Copy
example, err := ldap.NewAuthBackendUser(ctx, "authBackendUserResource", &ldap.AuthBackendUserArgs{
	Username: pulumi.String("string"),
	Backend:  pulumi.String("string"),
	Groups: pulumi.StringArray{
		pulumi.String("string"),
	},
	Namespace: pulumi.String("string"),
	Policies: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var authBackendUserResource = new AuthBackendUser("authBackendUserResource", AuthBackendUserArgs.builder()
    .username("string")
    .backend("string")
    .groups("string")
    .namespace("string")
    .policies("string")
    .build());
Copy
auth_backend_user_resource = vault.ldap.AuthBackendUser("authBackendUserResource",
    username="string",
    backend="string",
    groups=["string"],
    namespace="string",
    policies=["string"])
Copy
const authBackendUserResource = new vault.ldap.AuthBackendUser("authBackendUserResource", {
    username: "string",
    backend: "string",
    groups: ["string"],
    namespace: "string",
    policies: ["string"],
});
Copy
type: vault:ldap:AuthBackendUser
properties:
    backend: string
    groups:
        - string
    namespace: string
    policies:
        - string
    username: string
Copy

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

Username This property is required. string
The LDAP username
Backend Changes to this property will trigger replacement. string

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

Groups List<string>
Override LDAP groups which should be granted to user
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
Policies List<string>
Policies which should be granted to user
Username This property is required. string
The LDAP username
Backend Changes to this property will trigger replacement. string

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

Groups []string
Override LDAP groups which should be granted to user
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
Policies []string
Policies which should be granted to user
username This property is required. String
The LDAP username
backend Changes to this property will trigger replacement. String

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups List<String>
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies List<String>
Policies which should be granted to user
username This property is required. string
The LDAP username
backend Changes to this property will trigger replacement. string

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups string[]
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies string[]
Policies which should be granted to user
username This property is required. str
The LDAP username
backend Changes to this property will trigger replacement. str

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups Sequence[str]
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. str
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies Sequence[str]
Policies which should be granted to user
username This property is required. String
The LDAP username
backend Changes to this property will trigger replacement. String

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups List<String>
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies List<String>
Policies which should be granted to user

Outputs

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

Get an existing AuthBackendUser 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?: AuthBackendUserState, opts?: CustomResourceOptions): AuthBackendUser
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backend: Optional[str] = None,
        groups: Optional[Sequence[str]] = None,
        namespace: Optional[str] = None,
        policies: Optional[Sequence[str]] = None,
        username: Optional[str] = None) -> AuthBackendUser
func GetAuthBackendUser(ctx *Context, name string, id IDInput, state *AuthBackendUserState, opts ...ResourceOption) (*AuthBackendUser, error)
public static AuthBackendUser Get(string name, Input<string> id, AuthBackendUserState? state, CustomResourceOptions? opts = null)
public static AuthBackendUser get(String name, Output<String> id, AuthBackendUserState state, CustomResourceOptions options)
resources:  _:    type: vault:ldap:AuthBackendUser    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:
Backend Changes to this property will trigger replacement. string

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

Groups List<string>
Override LDAP groups which should be granted to user
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
Policies List<string>
Policies which should be granted to user
Username string
The LDAP username
Backend Changes to this property will trigger replacement. string

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

Groups []string
Override LDAP groups which should be granted to user
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
Policies []string
Policies which should be granted to user
Username string
The LDAP username
backend Changes to this property will trigger replacement. String

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups List<String>
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies List<String>
Policies which should be granted to user
username String
The LDAP username
backend Changes to this property will trigger replacement. string

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups string[]
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies string[]
Policies which should be granted to user
username string
The LDAP username
backend Changes to this property will trigger replacement. str

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups Sequence[str]
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. str
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies Sequence[str]
Policies which should be granted to user
username str
The LDAP username
backend Changes to this property will trigger replacement. String

Path to the authentication backend

For more details on the usage of each argument consult the Vault LDAP API documentation.

groups List<String>
Override LDAP groups which should be granted to user
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
policies List<String>
Policies which should be granted to user
username String
The LDAP username

Import

LDAP authentication backend users can be imported using the path, e.g.

$ pulumi import vault:ldap/authBackendUser:AuthBackendUser foo auth/ldap/users/foo
Copy

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

Package Details

Repository
Vault pulumi/pulumi-vault
License
Apache-2.0
Notes
This Pulumi package is based on the vault Terraform Provider.