1. Packages
  2. Pulumi Vault Provider
  3. API Docs
  4. ad
  5. SecretRole
HashiCorp Vault v6.4.0 published on Wednesday, Nov 20, 2024 by Pulumi

vault.ad.SecretRole

Explore with Pulumi AI

vault logo
HashiCorp Vault v6.4.0 published on Wednesday, Nov 20, 2024 by Pulumi

    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 role = new vault.ad.SecretRole("role", {
        backend: config.backend,
        role: "bob",
        serviceAccountName: "Bob",
        ttl: 60,
    });
    
    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")
    role = vault.ad.SecretRole("role",
        backend=config.backend,
        role="bob",
        service_account_name="Bob",
        ttl=60)
    
    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.NewSecretRole(ctx, "role", &ad.SecretRoleArgs{
    			Backend:            config.Backend,
    			Role:               pulumi.String("bob"),
    			ServiceAccountName: pulumi.String("Bob"),
    			Ttl:                pulumi.Int(60),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 role = new Vault.AD.SecretRole("role", new()
        {
            Backend = config.Backend,
            Role = "bob",
            ServiceAccountName = "Bob",
            Ttl = 60,
        });
    
    });
    
    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.SecretRole;
    import com.pulumi.vault.ad.SecretRoleArgs;
    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 role = new SecretRole("role", SecretRoleArgs.builder()
                .backend(config.backend())
                .role("bob")
                .serviceAccountName("Bob")
                .ttl(60)
                .build());
    
        }
    }
    
    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
      role:
        type: vault:ad:SecretRole
        properties:
          backend: ${config.backend}
          role: bob
          serviceAccountName: Bob
          ttl: 60
    

    Create SecretRole Resource

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

    Constructor syntax

    new SecretRole(name: string, args: SecretRoleArgs, opts?: CustomResourceOptions);
    @overload
    def SecretRole(resource_name: str,
                   args: SecretRoleArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def SecretRole(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   backend: Optional[str] = None,
                   role: Optional[str] = None,
                   service_account_name: Optional[str] = None,
                   namespace: Optional[str] = None,
                   ttl: Optional[int] = None)
    func NewSecretRole(ctx *Context, name string, args SecretRoleArgs, opts ...ResourceOption) (*SecretRole, error)
    public SecretRole(string name, SecretRoleArgs args, CustomResourceOptions? opts = null)
    public SecretRole(String name, SecretRoleArgs args)
    public SecretRole(String name, SecretRoleArgs args, CustomResourceOptions options)
    
    type: vault:ad:SecretRole
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SecretRoleArgs
    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 SecretRoleArgs
    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 SecretRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SecretRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SecretRoleArgs
    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 secretRoleResource = new Vault.AD.SecretRole("secretRoleResource", new()
    {
        Backend = "string",
        Role = "string",
        ServiceAccountName = "string",
        Namespace = "string",
        Ttl = 0,
    });
    
    example, err := ad.NewSecretRole(ctx, "secretRoleResource", &ad.SecretRoleArgs{
    	Backend:            pulumi.String("string"),
    	Role:               pulumi.String("string"),
    	ServiceAccountName: pulumi.String("string"),
    	Namespace:          pulumi.String("string"),
    	Ttl:                pulumi.Int(0),
    })
    
    var secretRoleResource = new SecretRole("secretRoleResource", SecretRoleArgs.builder()
        .backend("string")
        .role("string")
        .serviceAccountName("string")
        .namespace("string")
        .ttl(0)
        .build());
    
    secret_role_resource = vault.ad.SecretRole("secretRoleResource",
        backend="string",
        role="string",
        service_account_name="string",
        namespace="string",
        ttl=0)
    
    const secretRoleResource = new vault.ad.SecretRole("secretRoleResource", {
        backend: "string",
        role: "string",
        serviceAccountName: "string",
        namespace: "string",
        ttl: 0,
    });
    
    type: vault:ad:SecretRole
    properties:
        backend: string
        namespace: string
        role: string
        serviceAccountName: string
        ttl: 0
    

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

    Backend string
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    Role string
    The name to identify this role within the backend. Must be unique within the backend.
    ServiceAccountName string
    Specifies the name of the Active Directory service account mapped to this role.
    Namespace 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 string
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    Role string
    The name to identify this role within the backend. Must be unique within the backend.
    ServiceAccountName string
    Specifies the name of the Active Directory service account mapped to this role.
    Namespace 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 String
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    role String
    The name to identify this role within the backend. Must be unique within the backend.
    serviceAccountName String
    Specifies the name of the Active Directory service account mapped to this role.
    namespace 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 string
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    role string
    The name to identify this role within the backend. Must be unique within the backend.
    serviceAccountName string
    Specifies the name of the Active Directory service account mapped to this role.
    namespace 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 str
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    role str
    The name to identify this role within the backend. Must be unique within the backend.
    service_account_name str
    Specifies the name of the Active Directory service account mapped to this role.
    namespace 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 String
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    role String
    The name to identify this role within the backend. Must be unique within the backend.
    serviceAccountName String
    Specifies the name of the Active Directory service account mapped to this role.
    namespace 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 SecretRole resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    LastVaultRotation string
    Timestamp of the last password rotation by Vault.
    PasswordLastSet string
    Timestamp of the last password set by Vault.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastVaultRotation string
    Timestamp of the last password rotation by Vault.
    PasswordLastSet string
    Timestamp of the last password set by Vault.
    id String
    The provider-assigned unique ID for this managed resource.
    lastVaultRotation String
    Timestamp of the last password rotation by Vault.
    passwordLastSet String
    Timestamp of the last password set by Vault.
    id string
    The provider-assigned unique ID for this managed resource.
    lastVaultRotation string
    Timestamp of the last password rotation by Vault.
    passwordLastSet string
    Timestamp of the last password set by Vault.
    id str
    The provider-assigned unique ID for this managed resource.
    last_vault_rotation str
    Timestamp of the last password rotation by Vault.
    password_last_set str
    Timestamp of the last password set by Vault.
    id String
    The provider-assigned unique ID for this managed resource.
    lastVaultRotation String
    Timestamp of the last password rotation by Vault.
    passwordLastSet String
    Timestamp of the last password set by Vault.

    Look up Existing SecretRole Resource

    Get an existing SecretRole 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?: SecretRoleState, opts?: CustomResourceOptions): SecretRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backend: Optional[str] = None,
            last_vault_rotation: Optional[str] = None,
            namespace: Optional[str] = None,
            password_last_set: Optional[str] = None,
            role: Optional[str] = None,
            service_account_name: Optional[str] = None,
            ttl: Optional[int] = None) -> SecretRole
    func GetSecretRole(ctx *Context, name string, id IDInput, state *SecretRoleState, opts ...ResourceOption) (*SecretRole, error)
    public static SecretRole Get(string name, Input<string> id, SecretRoleState? state, CustomResourceOptions? opts = null)
    public static SecretRole get(String name, Output<String> id, SecretRoleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Backend string
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    LastVaultRotation string
    Timestamp of the last password rotation by Vault.
    Namespace 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.
    PasswordLastSet string
    Timestamp of the last password set by Vault.
    Role string
    The name to identify this role within the backend. Must be unique within the backend.
    ServiceAccountName string
    Specifies the name of the Active Directory service account mapped to this role.
    Ttl int
    The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
    Backend string
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    LastVaultRotation string
    Timestamp of the last password rotation by Vault.
    Namespace 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.
    PasswordLastSet string
    Timestamp of the last password set by Vault.
    Role string
    The name to identify this role within the backend. Must be unique within the backend.
    ServiceAccountName string
    Specifies the name of the Active Directory service account mapped to this role.
    Ttl int
    The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
    backend String
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    lastVaultRotation String
    Timestamp of the last password rotation by Vault.
    namespace 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.
    passwordLastSet String
    Timestamp of the last password set by Vault.
    role String
    The name to identify this role within the backend. Must be unique within the backend.
    serviceAccountName String
    Specifies the name of the Active Directory service account mapped to this role.
    ttl Integer
    The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
    backend string
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    lastVaultRotation string
    Timestamp of the last password rotation by Vault.
    namespace 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.
    passwordLastSet string
    Timestamp of the last password set by Vault.
    role string
    The name to identify this role within the backend. Must be unique within the backend.
    serviceAccountName string
    Specifies the name of the Active Directory service account mapped to this role.
    ttl number
    The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
    backend str
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    last_vault_rotation str
    Timestamp of the last password rotation by Vault.
    namespace 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.
    password_last_set str
    Timestamp of the last password set by Vault.
    role str
    The name to identify this role within the backend. Must be unique within the backend.
    service_account_name str
    Specifies the name of the Active Directory service account mapped to this role.
    ttl int
    The password time-to-live in seconds. Defaults to the configuration ttl if not provided.
    backend String
    The path the AD secret backend is mounted at, with no leading or trailing /s.
    lastVaultRotation String
    Timestamp of the last password rotation by Vault.
    namespace 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.
    passwordLastSet String
    Timestamp of the last password set by Vault.
    role String
    The name to identify this role within the backend. Must be unique within the backend.
    serviceAccountName String
    Specifies the name of the Active Directory service account mapped to this role.
    ttl Number
    The password time-to-live in seconds. Defaults to the configuration ttl if not provided.

    Import

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

    $ pulumi import vault:ad/secretRole:SecretRole role ad/roles/bob
    

    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.
    vault logo
    HashiCorp Vault v6.4.0 published on Wednesday, Nov 20, 2024 by Pulumi