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

vault.ldap.SecretBackendStaticRole

Explore with Pulumi AI

Example Usage

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

const config = new vault.ldap.SecretBackend("config", {
    path: "my-custom-ldap",
    binddn: "CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
    bindpass: "SuperSecretPassw0rd",
    url: "ldaps://localhost",
    insecureTls: true,
    userdn: "CN=Users,DC=corp,DC=example,DC=net",
});
const role = new vault.ldap.SecretBackendStaticRole("role", {
    mount: config.path,
    username: "alice",
    dn: "cn=alice,ou=Users,DC=corp,DC=example,DC=net",
    roleName: "alice",
    rotationPeriod: 60,
});
Copy
import pulumi
import pulumi_vault as vault

config = vault.ldap.SecretBackend("config",
    path="my-custom-ldap",
    binddn="CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
    bindpass="SuperSecretPassw0rd",
    url="ldaps://localhost",
    insecure_tls=True,
    userdn="CN=Users,DC=corp,DC=example,DC=net")
role = vault.ldap.SecretBackendStaticRole("role",
    mount=config.path,
    username="alice",
    dn="cn=alice,ou=Users,DC=corp,DC=example,DC=net",
    role_name="alice",
    rotation_period=60)
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 {
		config, err := ldap.NewSecretBackend(ctx, "config", &ldap.SecretBackendArgs{
			Path:        pulumi.String("my-custom-ldap"),
			Binddn:      pulumi.String("CN=Administrator,CN=Users,DC=corp,DC=example,DC=net"),
			Bindpass:    pulumi.String("SuperSecretPassw0rd"),
			Url:         pulumi.String("ldaps://localhost"),
			InsecureTls: pulumi.Bool(true),
			Userdn:      pulumi.String("CN=Users,DC=corp,DC=example,DC=net"),
		})
		if err != nil {
			return err
		}
		_, err = ldap.NewSecretBackendStaticRole(ctx, "role", &ldap.SecretBackendStaticRoleArgs{
			Mount:          config.Path,
			Username:       pulumi.String("alice"),
			Dn:             pulumi.String("cn=alice,ou=Users,DC=corp,DC=example,DC=net"),
			RoleName:       pulumi.String("alice"),
			RotationPeriod: pulumi.Int(60),
		})
		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 config = new Vault.Ldap.SecretBackend("config", new()
    {
        Path = "my-custom-ldap",
        Binddn = "CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
        Bindpass = "SuperSecretPassw0rd",
        Url = "ldaps://localhost",
        InsecureTls = true,
        Userdn = "CN=Users,DC=corp,DC=example,DC=net",
    });

    var role = new Vault.Ldap.SecretBackendStaticRole("role", new()
    {
        Mount = config.Path,
        Username = "alice",
        Dn = "cn=alice,ou=Users,DC=corp,DC=example,DC=net",
        RoleName = "alice",
        RotationPeriod = 60,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.ldap.SecretBackend;
import com.pulumi.vault.ldap.SecretBackendArgs;
import com.pulumi.vault.ldap.SecretBackendStaticRole;
import com.pulumi.vault.ldap.SecretBackendStaticRoleArgs;
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 config = new SecretBackend("config", SecretBackendArgs.builder()
            .path("my-custom-ldap")
            .binddn("CN=Administrator,CN=Users,DC=corp,DC=example,DC=net")
            .bindpass("SuperSecretPassw0rd")
            .url("ldaps://localhost")
            .insecureTls("true")
            .userdn("CN=Users,DC=corp,DC=example,DC=net")
            .build());

        var role = new SecretBackendStaticRole("role", SecretBackendStaticRoleArgs.builder()
            .mount(config.path())
            .username("alice")
            .dn("cn=alice,ou=Users,DC=corp,DC=example,DC=net")
            .roleName("alice")
            .rotationPeriod(60)
            .build());

    }
}
Copy
resources:
  config:
    type: vault:ldap:SecretBackend
    properties:
      path: my-custom-ldap
      binddn: CN=Administrator,CN=Users,DC=corp,DC=example,DC=net
      bindpass: SuperSecretPassw0rd
      url: ldaps://localhost
      insecureTls: 'true'
      userdn: CN=Users,DC=corp,DC=example,DC=net
  role:
    type: vault:ldap:SecretBackendStaticRole
    properties:
      mount: ${config.path}
      username: alice
      dn: cn=alice,ou=Users,DC=corp,DC=example,DC=net
      roleName: alice
      rotationPeriod: 60
Copy

Create SecretBackendStaticRole Resource

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

Constructor syntax

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

@overload
def SecretBackendStaticRole(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            role_name: Optional[str] = None,
                            rotation_period: Optional[int] = None,
                            username: Optional[str] = None,
                            dn: Optional[str] = None,
                            mount: Optional[str] = None,
                            namespace: Optional[str] = None,
                            skip_import_rotation: Optional[bool] = None)
func NewSecretBackendStaticRole(ctx *Context, name string, args SecretBackendStaticRoleArgs, opts ...ResourceOption) (*SecretBackendStaticRole, error)
public SecretBackendStaticRole(string name, SecretBackendStaticRoleArgs args, CustomResourceOptions? opts = null)
public SecretBackendStaticRole(String name, SecretBackendStaticRoleArgs args)
public SecretBackendStaticRole(String name, SecretBackendStaticRoleArgs args, CustomResourceOptions options)
type: vault:ldap:SecretBackendStaticRole
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. SecretBackendStaticRoleArgs
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. SecretBackendStaticRoleArgs
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. SecretBackendStaticRoleArgs
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. SecretBackendStaticRoleArgs
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. SecretBackendStaticRoleArgs
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 examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole = new Vault.Ldap.SecretBackendStaticRole("examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole", new()
{
    RoleName = "string",
    RotationPeriod = 0,
    Username = "string",
    Dn = "string",
    Mount = "string",
    Namespace = "string",
    SkipImportRotation = false,
});
Copy
example, err := ldap.NewSecretBackendStaticRole(ctx, "examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole", &ldap.SecretBackendStaticRoleArgs{
	RoleName:           pulumi.String("string"),
	RotationPeriod:     pulumi.Int(0),
	Username:           pulumi.String("string"),
	Dn:                 pulumi.String("string"),
	Mount:              pulumi.String("string"),
	Namespace:          pulumi.String("string"),
	SkipImportRotation: pulumi.Bool(false),
})
Copy
var examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole = new SecretBackendStaticRole("examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole", SecretBackendStaticRoleArgs.builder()
    .roleName("string")
    .rotationPeriod(0)
    .username("string")
    .dn("string")
    .mount("string")
    .namespace("string")
    .skipImportRotation(false)
    .build());
Copy
examplesecret_backend_static_role_resource_resource_from_ldapsecret_backend_static_role = vault.ldap.SecretBackendStaticRole("examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole",
    role_name="string",
    rotation_period=0,
    username="string",
    dn="string",
    mount="string",
    namespace="string",
    skip_import_rotation=False)
Copy
const examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole = new vault.ldap.SecretBackendStaticRole("examplesecretBackendStaticRoleResourceResourceFromLdapsecretBackendStaticRole", {
    roleName: "string",
    rotationPeriod: 0,
    username: "string",
    dn: "string",
    mount: "string",
    namespace: "string",
    skipImportRotation: false,
});
Copy
type: vault:ldap:SecretBackendStaticRole
properties:
    dn: string
    mount: string
    namespace: string
    roleName: string
    rotationPeriod: 0
    skipImportRotation: false
    username: string
Copy

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

RoleName
This property is required.
Changes to this property will trigger replacement.
string
Name of the role.
RotationPeriod This property is required. int
How often Vault should rotate the password of the user entry.
Username
This property is required.
Changes to this property will trigger replacement.
string
The username of the existing LDAP entry to manage password rotation for.
Dn string
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
Mount string
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
SkipImportRotation bool
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
RoleName
This property is required.
Changes to this property will trigger replacement.
string
Name of the role.
RotationPeriod This property is required. int
How often Vault should rotate the password of the user entry.
Username
This property is required.
Changes to this property will trigger replacement.
string
The username of the existing LDAP entry to manage password rotation for.
Dn string
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
Mount string
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
SkipImportRotation bool
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
roleName
This property is required.
Changes to this property will trigger replacement.
String
Name of the role.
rotationPeriod This property is required. Integer
How often Vault should rotate the password of the user entry.
username
This property is required.
Changes to this property will trigger replacement.
String
The username of the existing LDAP entry to manage password rotation for.
dn String
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount String
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
skipImportRotation Boolean
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
roleName
This property is required.
Changes to this property will trigger replacement.
string
Name of the role.
rotationPeriod This property is required. number
How often Vault should rotate the password of the user entry.
username
This property is required.
Changes to this property will trigger replacement.
string
The username of the existing LDAP entry to manage password rotation for.
dn string
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount string
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
skipImportRotation boolean
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
role_name
This property is required.
Changes to this property will trigger replacement.
str
Name of the role.
rotation_period This property is required. int
How often Vault should rotate the password of the user entry.
username
This property is required.
Changes to this property will trigger replacement.
str
The username of the existing LDAP entry to manage password rotation for.
dn str
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount str
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
skip_import_rotation bool
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
roleName
This property is required.
Changes to this property will trigger replacement.
String
Name of the role.
rotationPeriod This property is required. Number
How often Vault should rotate the password of the user entry.
username
This property is required.
Changes to this property will trigger replacement.
String
The username of the existing LDAP entry to manage password rotation for.
dn String
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount String
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
skipImportRotation Boolean
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.

Outputs

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

Get an existing SecretBackendStaticRole 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?: SecretBackendStaticRoleState, opts?: CustomResourceOptions): SecretBackendStaticRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dn: Optional[str] = None,
        mount: Optional[str] = None,
        namespace: Optional[str] = None,
        role_name: Optional[str] = None,
        rotation_period: Optional[int] = None,
        skip_import_rotation: Optional[bool] = None,
        username: Optional[str] = None) -> SecretBackendStaticRole
func GetSecretBackendStaticRole(ctx *Context, name string, id IDInput, state *SecretBackendStaticRoleState, opts ...ResourceOption) (*SecretBackendStaticRole, error)
public static SecretBackendStaticRole Get(string name, Input<string> id, SecretBackendStaticRoleState? state, CustomResourceOptions? opts = null)
public static SecretBackendStaticRole get(String name, Output<String> id, SecretBackendStaticRoleState state, CustomResourceOptions options)
resources:  _:    type: vault:ldap:SecretBackendStaticRole    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:
Dn string
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
Mount string
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
RoleName Changes to this property will trigger replacement. string
Name of the role.
RotationPeriod int
How often Vault should rotate the password of the user entry.
SkipImportRotation bool
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
Username Changes to this property will trigger replacement. string
The username of the existing LDAP entry to manage password rotation for.
Dn string
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
Mount string
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
RoleName Changes to this property will trigger replacement. string
Name of the role.
RotationPeriod int
How often Vault should rotate the password of the user entry.
SkipImportRotation bool
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
Username Changes to this property will trigger replacement. string
The username of the existing LDAP entry to manage password rotation for.
dn String
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount String
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
roleName Changes to this property will trigger replacement. String
Name of the role.
rotationPeriod Integer
How often Vault should rotate the password of the user entry.
skipImportRotation Boolean
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
username Changes to this property will trigger replacement. String
The username of the existing LDAP entry to manage password rotation for.
dn string
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount string
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
roleName Changes to this property will trigger replacement. string
Name of the role.
rotationPeriod number
How often Vault should rotate the password of the user entry.
skipImportRotation boolean
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
username Changes to this property will trigger replacement. string
The username of the existing LDAP entry to manage password rotation for.
dn str
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount str
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
role_name Changes to this property will trigger replacement. str
Name of the role.
rotation_period int
How often Vault should rotate the password of the user entry.
skip_import_rotation bool
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
username Changes to this property will trigger replacement. str
The username of the existing LDAP entry to manage password rotation for.
dn String
Distinguished name (DN) of the existing LDAP entry to manage password rotation for. If given, it will take precedence over username for the LDAP search performed during password rotation. Cannot be modified after creation.
mount String
The unique path this backend should be mounted at. Must not begin or end with a /. Defaults to ldap.
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.
roleName Changes to this property will trigger replacement. String
Name of the role.
rotationPeriod Number
How often Vault should rotate the password of the user entry.
skipImportRotation Boolean
Causes vault to skip the initial secret rotation on import. Not applicable to updates. Requires Vault 1.16 or above.
username Changes to this property will trigger replacement. String
The username of the existing LDAP entry to manage password rotation for.

Import

LDAP secret backend static role can be imported using the full path to the role of the form: <mount_path>/static-role/<role_name> e.g.

$ pulumi import vault:ldap/secretBackendStaticRole:SecretBackendStaticRole role ldap/static-role/example-role
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.