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

vault.ad.SecretLibrary

Explore with Pulumi AI

Example Usage

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

const config = new vault.ad.SecretBackend("config", {
    backend: "ad",
    binddn: "CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
    bindpass: "SuperSecretPassw0rd",
    url: "ldaps://ad",
    insecureTls: true,
    userdn: "CN=Users,DC=corp,DC=example,DC=net",
});
const qa = new vault.ad.SecretLibrary("qa", {
    backend: config.backend,
    name: "qa",
    serviceAccountNames: [
        "Bob",
        "Mary",
    ],
    ttl: 60,
    disableCheckInEnforcement: true,
    maxTtl: 120,
});
Copy
import pulumi
import pulumi_vault as vault

config = vault.ad.SecretBackend("config",
    backend="ad",
    binddn="CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
    bindpass="SuperSecretPassw0rd",
    url="ldaps://ad",
    insecure_tls=True,
    userdn="CN=Users,DC=corp,DC=example,DC=net")
qa = vault.ad.SecretLibrary("qa",
    backend=config.backend,
    name="qa",
    service_account_names=[
        "Bob",
        "Mary",
    ],
    ttl=60,
    disable_check_in_enforcement=True,
    max_ttl=120)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		config, err := ad.NewSecretBackend(ctx, "config", &ad.SecretBackendArgs{
			Backend:     pulumi.String("ad"),
			Binddn:      pulumi.String("CN=Administrator,CN=Users,DC=corp,DC=example,DC=net"),
			Bindpass:    pulumi.String("SuperSecretPassw0rd"),
			Url:         pulumi.String("ldaps://ad"),
			InsecureTls: pulumi.Bool(true),
			Userdn:      pulumi.String("CN=Users,DC=corp,DC=example,DC=net"),
		})
		if err != nil {
			return err
		}
		_, err = ad.NewSecretLibrary(ctx, "qa", &ad.SecretLibraryArgs{
			Backend: config.Backend,
			Name:    pulumi.String("qa"),
			ServiceAccountNames: pulumi.StringArray{
				pulumi.String("Bob"),
				pulumi.String("Mary"),
			},
			Ttl:                       pulumi.Int(60),
			DisableCheckInEnforcement: pulumi.Bool(true),
			MaxTtl:                    pulumi.Int(120),
		})
		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.AD.SecretBackend("config", new()
    {
        Backend = "ad",
        Binddn = "CN=Administrator,CN=Users,DC=corp,DC=example,DC=net",
        Bindpass = "SuperSecretPassw0rd",
        Url = "ldaps://ad",
        InsecureTls = true,
        Userdn = "CN=Users,DC=corp,DC=example,DC=net",
    });

    var qa = new Vault.AD.SecretLibrary("qa", new()
    {
        Backend = config.Backend,
        Name = "qa",
        ServiceAccountNames = new[]
        {
            "Bob",
            "Mary",
        },
        Ttl = 60,
        DisableCheckInEnforcement = true,
        MaxTtl = 120,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.ad.SecretBackend;
import com.pulumi.vault.ad.SecretBackendArgs;
import com.pulumi.vault.ad.SecretLibrary;
import com.pulumi.vault.ad.SecretLibraryArgs;
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()
            .backend("ad")
            .binddn("CN=Administrator,CN=Users,DC=corp,DC=example,DC=net")
            .bindpass("SuperSecretPassw0rd")
            .url("ldaps://ad")
            .insecureTls("true")
            .userdn("CN=Users,DC=corp,DC=example,DC=net")
            .build());

        var qa = new SecretLibrary("qa", SecretLibraryArgs.builder()
            .backend(config.backend())
            .name("qa")
            .serviceAccountNames(            
                "Bob",
                "Mary")
            .ttl(60)
            .disableCheckInEnforcement(true)
            .maxTtl(120)
            .build());

    }
}
Copy
resources:
  config:
    type: vault:ad:SecretBackend
    properties:
      backend: ad
      binddn: CN=Administrator,CN=Users,DC=corp,DC=example,DC=net
      bindpass: SuperSecretPassw0rd
      url: ldaps://ad
      insecureTls: 'true'
      userdn: CN=Users,DC=corp,DC=example,DC=net
  qa:
    type: vault:ad:SecretLibrary
    properties:
      backend: ${config.backend}
      name: qa
      serviceAccountNames:
        - Bob
        - Mary
      ttl: 60
      disableCheckInEnforcement: true
      maxTtl: 120
Copy

Create SecretLibrary Resource

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

Constructor syntax

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

@overload
def SecretLibrary(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  backend: Optional[str] = None,
                  service_account_names: Optional[Sequence[str]] = None,
                  disable_check_in_enforcement: Optional[bool] = None,
                  max_ttl: Optional[int] = None,
                  name: Optional[str] = None,
                  namespace: Optional[str] = None,
                  ttl: Optional[int] = None)
func NewSecretLibrary(ctx *Context, name string, args SecretLibraryArgs, opts ...ResourceOption) (*SecretLibrary, error)
public SecretLibrary(string name, SecretLibraryArgs args, CustomResourceOptions? opts = null)
public SecretLibrary(String name, SecretLibraryArgs args)
public SecretLibrary(String name, SecretLibraryArgs args, CustomResourceOptions options)
type: vault:ad:SecretLibrary
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. SecretLibraryArgs
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. SecretLibraryArgs
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. SecretLibraryArgs
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. SecretLibraryArgs
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. SecretLibraryArgs
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 secretLibraryResource = new Vault.AD.SecretLibrary("secretLibraryResource", new()
{
    Backend = "string",
    ServiceAccountNames = new[]
    {
        "string",
    },
    DisableCheckInEnforcement = false,
    MaxTtl = 0,
    Name = "string",
    Namespace = "string",
    Ttl = 0,
});
Copy
example, err := ad.NewSecretLibrary(ctx, "secretLibraryResource", &ad.SecretLibraryArgs{
	Backend: pulumi.String("string"),
	ServiceAccountNames: pulumi.StringArray{
		pulumi.String("string"),
	},
	DisableCheckInEnforcement: pulumi.Bool(false),
	MaxTtl:                    pulumi.Int(0),
	Name:                      pulumi.String("string"),
	Namespace:                 pulumi.String("string"),
	Ttl:                       pulumi.Int(0),
})
Copy
var secretLibraryResource = new SecretLibrary("secretLibraryResource", SecretLibraryArgs.builder()
    .backend("string")
    .serviceAccountNames("string")
    .disableCheckInEnforcement(false)
    .maxTtl(0)
    .name("string")
    .namespace("string")
    .ttl(0)
    .build());
Copy
secret_library_resource = vault.ad.SecretLibrary("secretLibraryResource",
    backend="string",
    service_account_names=["string"],
    disable_check_in_enforcement=False,
    max_ttl=0,
    name="string",
    namespace="string",
    ttl=0)
Copy
const secretLibraryResource = new vault.ad.SecretLibrary("secretLibraryResource", {
    backend: "string",
    serviceAccountNames: ["string"],
    disableCheckInEnforcement: false,
    maxTtl: 0,
    name: "string",
    namespace: "string",
    ttl: 0,
});
Copy
type: vault:ad:SecretLibrary
properties:
    backend: string
    disableCheckInEnforcement: false
    maxTtl: 0
    name: string
    namespace: string
    serviceAccountNames:
        - string
    ttl: 0
Copy

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

Backend
This property is required.
Changes to this property will trigger replacement.
string
The path the AD secret backend is mounted at, with no leading or trailing /s.
ServiceAccountNames
This property is required.
Changes to this property will trigger replacement.
List<string>
Specifies the slice of service accounts mapped to this set.
DisableCheckInEnforcement bool
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
MaxTtl int
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
Name Changes to this property will trigger replacement. string
The name to identify this set of service accounts. Must be unique within the backend.
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.
Ttl int
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
Backend
This property is required.
Changes to this property will trigger replacement.
string
The path the AD secret backend is mounted at, with no leading or trailing /s.
ServiceAccountNames
This property is required.
Changes to this property will trigger replacement.
[]string
Specifies the slice of service accounts mapped to this set.
DisableCheckInEnforcement bool
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
MaxTtl int
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
Name Changes to this property will trigger replacement. string
The name to identify this set of service accounts. Must be unique within the backend.
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.
Ttl int
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend
This property is required.
Changes to this property will trigger replacement.
String
The path the AD secret backend is mounted at, with no leading or trailing /s.
serviceAccountNames
This property is required.
Changes to this property will trigger replacement.
List<String>
Specifies the slice of service accounts mapped to this set.
disableCheckInEnforcement Boolean
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
maxTtl Integer
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. String
The name to identify this set of service accounts. Must be unique within the backend.
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.
ttl Integer
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend
This property is required.
Changes to this property will trigger replacement.
string
The path the AD secret backend is mounted at, with no leading or trailing /s.
serviceAccountNames
This property is required.
Changes to this property will trigger replacement.
string[]
Specifies the slice of service accounts mapped to this set.
disableCheckInEnforcement boolean
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
maxTtl number
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. string
The name to identify this set of service accounts. Must be unique within the backend.
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.
ttl number
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend
This property is required.
Changes to this property will trigger replacement.
str
The path the AD secret backend is mounted at, with no leading or trailing /s.
service_account_names
This property is required.
Changes to this property will trigger replacement.
Sequence[str]
Specifies the slice of service accounts mapped to this set.
disable_check_in_enforcement bool
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
max_ttl int
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. str
The name to identify this set of service accounts. Must be unique within the backend.
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.
ttl int
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend
This property is required.
Changes to this property will trigger replacement.
String
The path the AD secret backend is mounted at, with no leading or trailing /s.
serviceAccountNames
This property is required.
Changes to this property will trigger replacement.
List<String>
Specifies the slice of service accounts mapped to this set.
disableCheckInEnforcement Boolean
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
maxTtl Number
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. String
The name to identify this set of service accounts. Must be unique within the backend.
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.
ttl Number
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.

Outputs

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

Get an existing SecretLibrary 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?: SecretLibraryState, opts?: CustomResourceOptions): SecretLibrary
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backend: Optional[str] = None,
        disable_check_in_enforcement: Optional[bool] = None,
        max_ttl: Optional[int] = None,
        name: Optional[str] = None,
        namespace: Optional[str] = None,
        service_account_names: Optional[Sequence[str]] = None,
        ttl: Optional[int] = None) -> SecretLibrary
func GetSecretLibrary(ctx *Context, name string, id IDInput, state *SecretLibraryState, opts ...ResourceOption) (*SecretLibrary, error)
public static SecretLibrary Get(string name, Input<string> id, SecretLibraryState? state, CustomResourceOptions? opts = null)
public static SecretLibrary get(String name, Output<String> id, SecretLibraryState state, CustomResourceOptions options)
resources:  _:    type: vault:ad:SecretLibrary    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
The path the AD secret backend is mounted at, with no leading or trailing /s.
DisableCheckInEnforcement bool
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
MaxTtl int
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
Name Changes to this property will trigger replacement. string
The name to identify this set of service accounts. Must be unique within the backend.
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.
ServiceAccountNames Changes to this property will trigger replacement. List<string>
Specifies the slice of service accounts mapped to this set.
Ttl int
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
Backend Changes to this property will trigger replacement. string
The path the AD secret backend is mounted at, with no leading or trailing /s.
DisableCheckInEnforcement bool
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
MaxTtl int
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
Name Changes to this property will trigger replacement. string
The name to identify this set of service accounts. Must be unique within the backend.
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.
ServiceAccountNames Changes to this property will trigger replacement. []string
Specifies the slice of service accounts mapped to this set.
Ttl int
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend Changes to this property will trigger replacement. String
The path the AD secret backend is mounted at, with no leading or trailing /s.
disableCheckInEnforcement Boolean
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
maxTtl Integer
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. String
The name to identify this set of service accounts. Must be unique within the backend.
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.
serviceAccountNames Changes to this property will trigger replacement. List<String>
Specifies the slice of service accounts mapped to this set.
ttl Integer
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend Changes to this property will trigger replacement. string
The path the AD secret backend is mounted at, with no leading or trailing /s.
disableCheckInEnforcement boolean
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
maxTtl number
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. string
The name to identify this set of service accounts. Must be unique within the backend.
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.
serviceAccountNames Changes to this property will trigger replacement. string[]
Specifies the slice of service accounts mapped to this set.
ttl number
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend Changes to this property will trigger replacement. str
The path the AD secret backend is mounted at, with no leading or trailing /s.
disable_check_in_enforcement bool
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
max_ttl int
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. str
The name to identify this set of service accounts. Must be unique within the backend.
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.
service_account_names Changes to this property will trigger replacement. Sequence[str]
Specifies the slice of service accounts mapped to this set.
ttl int
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
backend Changes to this property will trigger replacement. String
The path the AD secret backend is mounted at, with no leading or trailing /s.
disableCheckInEnforcement Boolean
Disable enforcing that service accounts must be checked in by the entity or client token that checked them out.
maxTtl Number
The maximum password time-to-live in seconds. Defaults to the configuration max_ttl if not provided.
name Changes to this property will trigger replacement. String
The name to identify this set of service accounts. Must be unique within the backend.
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.
serviceAccountNames Changes to this property will trigger replacement. List<String>
Specifies the slice of service accounts mapped to this set.
ttl Number
The password time-to-live in seconds. Defaults to the configuration ttl if not provided.

Import

AD secret backend libraries can be imported using the path, e.g.

$ pulumi import vault:ad/secretLibrary:SecretLibrary role ad/library/bob
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.