1. Packages
  2. HashiCorp Vault
  3. API Docs
  4. appRole
  5. AuthBackendLogin
HashiCorp Vault v5.15.1 published on Tuesday, Sep 26, 2023 by Pulumi

vault.appRole.AuthBackendLogin

Explore with Pulumi AI

vault logo
HashiCorp Vault v5.15.1 published on Tuesday, Sep 26, 2023 by Pulumi

    Logs into Vault using the AppRole auth backend. See the Vault documentation for more information.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var approle = new Vault.AuthBackend("approle", new()
        {
            Type = "approle",
        });
    
        var example = new Vault.AppRole.AuthBackendRole("example", new()
        {
            Backend = approle.Path,
            RoleName = "test-role",
            TokenPolicies = new[]
            {
                "default",
                "dev",
                "prod",
            },
        });
    
        var id = new Vault.AppRole.AuthBackendRoleSecretId("id", new()
        {
            Backend = approle.Path,
            RoleName = example.RoleName,
        });
    
        var login = new Vault.AppRole.AuthBackendLogin("login", new()
        {
            Backend = approle.Path,
            RoleId = example.RoleId,
            SecretId = id.SecretId,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v5/go/vault"
    	"github.com/pulumi/pulumi-vault/sdk/v5/go/vault/appRole"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		approle, err := vault.NewAuthBackend(ctx, "approle", &vault.AuthBackendArgs{
    			Type: pulumi.String("approle"),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := appRole.NewAuthBackendRole(ctx, "example", &appRole.AuthBackendRoleArgs{
    			Backend:  approle.Path,
    			RoleName: pulumi.String("test-role"),
    			TokenPolicies: pulumi.StringArray{
    				pulumi.String("default"),
    				pulumi.String("dev"),
    				pulumi.String("prod"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		id, err := appRole.NewAuthBackendRoleSecretId(ctx, "id", &appRole.AuthBackendRoleSecretIdArgs{
    			Backend:  approle.Path,
    			RoleName: example.RoleName,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appRole.NewAuthBackendLogin(ctx, "login", &appRole.AuthBackendLoginArgs{
    			Backend:  approle.Path,
    			RoleId:   example.RoleId,
    			SecretId: id.SecretId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.AuthBackend;
    import com.pulumi.vault.AuthBackendArgs;
    import com.pulumi.vault.appRole.AuthBackendRole;
    import com.pulumi.vault.appRole.AuthBackendRoleArgs;
    import com.pulumi.vault.appRole.AuthBackendRoleSecretId;
    import com.pulumi.vault.appRole.AuthBackendRoleSecretIdArgs;
    import com.pulumi.vault.appRole.AuthBackendLogin;
    import com.pulumi.vault.appRole.AuthBackendLoginArgs;
    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 approle = new AuthBackend("approle", AuthBackendArgs.builder()        
                .type("approle")
                .build());
    
            var example = new AuthBackendRole("example", AuthBackendRoleArgs.builder()        
                .backend(approle.path())
                .roleName("test-role")
                .tokenPolicies(            
                    "default",
                    "dev",
                    "prod")
                .build());
    
            var id = new AuthBackendRoleSecretId("id", AuthBackendRoleSecretIdArgs.builder()        
                .backend(approle.path())
                .roleName(example.roleName())
                .build());
    
            var login = new AuthBackendLogin("login", AuthBackendLoginArgs.builder()        
                .backend(approle.path())
                .roleId(example.roleId())
                .secretId(id.secretId())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_vault as vault
    
    approle = vault.AuthBackend("approle", type="approle")
    example = vault.app_role.AuthBackendRole("example",
        backend=approle.path,
        role_name="test-role",
        token_policies=[
            "default",
            "dev",
            "prod",
        ])
    id = vault.app_role.AuthBackendRoleSecretId("id",
        backend=approle.path,
        role_name=example.role_name)
    login = vault.app_role.AuthBackendLogin("login",
        backend=approle.path,
        role_id=example.role_id,
        secret_id=id.secret_id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const approle = new vault.AuthBackend("approle", {type: "approle"});
    const example = new vault.approle.AuthBackendRole("example", {
        backend: approle.path,
        roleName: "test-role",
        tokenPolicies: [
            "default",
            "dev",
            "prod",
        ],
    });
    const id = new vault.approle.AuthBackendRoleSecretId("id", {
        backend: approle.path,
        roleName: example.roleName,
    });
    const login = new vault.approle.AuthBackendLogin("login", {
        backend: approle.path,
        roleId: example.roleId,
        secretId: id.secretId,
    });
    
    resources:
      approle:
        type: vault:AuthBackend
        properties:
          type: approle
      example:
        type: vault:appRole:AuthBackendRole
        properties:
          backend: ${approle.path}
          roleName: test-role
          tokenPolicies:
            - default
            - dev
            - prod
      id:
        type: vault:appRole:AuthBackendRoleSecretId
        properties:
          backend: ${approle.path}
          roleName: ${example.roleName}
      login:
        type: vault:appRole:AuthBackendLogin
        properties:
          backend: ${approle.path}
          roleId: ${example.roleId}
          secretId: ${id.secretId}
    

    Create AuthBackendLogin Resource

    new AuthBackendLogin(name: string, args: AuthBackendLoginArgs, opts?: CustomResourceOptions);
    @overload
    def AuthBackendLogin(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         backend: Optional[str] = None,
                         namespace: Optional[str] = None,
                         role_id: Optional[str] = None,
                         secret_id: Optional[str] = None)
    @overload
    def AuthBackendLogin(resource_name: str,
                         args: AuthBackendLoginArgs,
                         opts: Optional[ResourceOptions] = None)
    func NewAuthBackendLogin(ctx *Context, name string, args AuthBackendLoginArgs, opts ...ResourceOption) (*AuthBackendLogin, error)
    public AuthBackendLogin(string name, AuthBackendLoginArgs args, CustomResourceOptions? opts = null)
    public AuthBackendLogin(String name, AuthBackendLoginArgs args)
    public AuthBackendLogin(String name, AuthBackendLoginArgs args, CustomResourceOptions options)
    
    type: vault:appRole:AuthBackendLogin
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args AuthBackendLoginArgs
    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 AuthBackendLoginArgs
    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 AuthBackendLoginArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AuthBackendLoginArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AuthBackendLoginArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    AuthBackendLogin Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The AuthBackendLogin resource accepts the following input properties:

    RoleId string

    The ID of the role to log in with.

    Backend string

    The unique path of the Vault backend to log in with.

    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.

    SecretId string

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    RoleId string

    The ID of the role to log in with.

    Backend string

    The unique path of the Vault backend to log in with.

    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.

    SecretId string

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    roleId String

    The ID of the role to log in with.

    backend String

    The unique path of the Vault backend to log in with.

    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.

    secretId String

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    roleId string

    The ID of the role to log in with.

    backend string

    The unique path of the Vault backend to log in with.

    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.

    secretId string

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    role_id str

    The ID of the role to log in with.

    backend str

    The unique path of the Vault backend to log in with.

    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.

    secret_id str

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    roleId String

    The ID of the role to log in with.

    backend String

    The unique path of the Vault backend to log in with.

    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.

    secretId String

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AuthBackendLogin resource produces the following output properties:

    Accessor string

    The accessor for the token.

    ClientToken string

    The Vault token created.

    Id string

    The provider-assigned unique ID for this managed resource.

    LeaseDuration int

    How long the token is valid for, in seconds.

    LeaseStarted string

    The date and time the lease started, in RFC 3339 format.

    Metadata Dictionary<string, string>

    The metadata associated with the token.

    Policies List<string>

    A list of policies applied to the token.

    Renewable bool

    Whether the token is renewable or not.

    Accessor string

    The accessor for the token.

    ClientToken string

    The Vault token created.

    Id string

    The provider-assigned unique ID for this managed resource.

    LeaseDuration int

    How long the token is valid for, in seconds.

    LeaseStarted string

    The date and time the lease started, in RFC 3339 format.

    Metadata map[string]string

    The metadata associated with the token.

    Policies []string

    A list of policies applied to the token.

    Renewable bool

    Whether the token is renewable or not.

    accessor String

    The accessor for the token.

    clientToken String

    The Vault token created.

    id String

    The provider-assigned unique ID for this managed resource.

    leaseDuration Integer

    How long the token is valid for, in seconds.

    leaseStarted String

    The date and time the lease started, in RFC 3339 format.

    metadata Map<String,String>

    The metadata associated with the token.

    policies List<String>

    A list of policies applied to the token.

    renewable Boolean

    Whether the token is renewable or not.

    accessor string

    The accessor for the token.

    clientToken string

    The Vault token created.

    id string

    The provider-assigned unique ID for this managed resource.

    leaseDuration number

    How long the token is valid for, in seconds.

    leaseStarted string

    The date and time the lease started, in RFC 3339 format.

    metadata {[key: string]: string}

    The metadata associated with the token.

    policies string[]

    A list of policies applied to the token.

    renewable boolean

    Whether the token is renewable or not.

    accessor str

    The accessor for the token.

    client_token str

    The Vault token created.

    id str

    The provider-assigned unique ID for this managed resource.

    lease_duration int

    How long the token is valid for, in seconds.

    lease_started str

    The date and time the lease started, in RFC 3339 format.

    metadata Mapping[str, str]

    The metadata associated with the token.

    policies Sequence[str]

    A list of policies applied to the token.

    renewable bool

    Whether the token is renewable or not.

    accessor String

    The accessor for the token.

    clientToken String

    The Vault token created.

    id String

    The provider-assigned unique ID for this managed resource.

    leaseDuration Number

    How long the token is valid for, in seconds.

    leaseStarted String

    The date and time the lease started, in RFC 3339 format.

    metadata Map<String>

    The metadata associated with the token.

    policies List<String>

    A list of policies applied to the token.

    renewable Boolean

    Whether the token is renewable or not.

    Look up Existing AuthBackendLogin Resource

    Get an existing AuthBackendLogin 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?: AuthBackendLoginState, opts?: CustomResourceOptions): AuthBackendLogin
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            accessor: Optional[str] = None,
            backend: Optional[str] = None,
            client_token: Optional[str] = None,
            lease_duration: Optional[int] = None,
            lease_started: Optional[str] = None,
            metadata: Optional[Mapping[str, str]] = None,
            namespace: Optional[str] = None,
            policies: Optional[Sequence[str]] = None,
            renewable: Optional[bool] = None,
            role_id: Optional[str] = None,
            secret_id: Optional[str] = None) -> AuthBackendLogin
    func GetAuthBackendLogin(ctx *Context, name string, id IDInput, state *AuthBackendLoginState, opts ...ResourceOption) (*AuthBackendLogin, error)
    public static AuthBackendLogin Get(string name, Input<string> id, AuthBackendLoginState? state, CustomResourceOptions? opts = null)
    public static AuthBackendLogin get(String name, Output<String> id, AuthBackendLoginState 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:
    Accessor string

    The accessor for the token.

    Backend string

    The unique path of the Vault backend to log in with.

    ClientToken string

    The Vault token created.

    LeaseDuration int

    How long the token is valid for, in seconds.

    LeaseStarted string

    The date and time the lease started, in RFC 3339 format.

    Metadata Dictionary<string, string>

    The metadata associated with the token.

    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.

    Policies List<string>

    A list of policies applied to the token.

    Renewable bool

    Whether the token is renewable or not.

    RoleId string

    The ID of the role to log in with.

    SecretId string

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    Accessor string

    The accessor for the token.

    Backend string

    The unique path of the Vault backend to log in with.

    ClientToken string

    The Vault token created.

    LeaseDuration int

    How long the token is valid for, in seconds.

    LeaseStarted string

    The date and time the lease started, in RFC 3339 format.

    Metadata map[string]string

    The metadata associated with the token.

    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.

    Policies []string

    A list of policies applied to the token.

    Renewable bool

    Whether the token is renewable or not.

    RoleId string

    The ID of the role to log in with.

    SecretId string

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    accessor String

    The accessor for the token.

    backend String

    The unique path of the Vault backend to log in with.

    clientToken String

    The Vault token created.

    leaseDuration Integer

    How long the token is valid for, in seconds.

    leaseStarted String

    The date and time the lease started, in RFC 3339 format.

    metadata Map<String,String>

    The metadata associated with the token.

    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.

    policies List<String>

    A list of policies applied to the token.

    renewable Boolean

    Whether the token is renewable or not.

    roleId String

    The ID of the role to log in with.

    secretId String

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    accessor string

    The accessor for the token.

    backend string

    The unique path of the Vault backend to log in with.

    clientToken string

    The Vault token created.

    leaseDuration number

    How long the token is valid for, in seconds.

    leaseStarted string

    The date and time the lease started, in RFC 3339 format.

    metadata {[key: string]: string}

    The metadata associated with the token.

    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.

    policies string[]

    A list of policies applied to the token.

    renewable boolean

    Whether the token is renewable or not.

    roleId string

    The ID of the role to log in with.

    secretId string

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    accessor str

    The accessor for the token.

    backend str

    The unique path of the Vault backend to log in with.

    client_token str

    The Vault token created.

    lease_duration int

    How long the token is valid for, in seconds.

    lease_started str

    The date and time the lease started, in RFC 3339 format.

    metadata Mapping[str, str]

    The metadata associated with the token.

    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.

    policies Sequence[str]

    A list of policies applied to the token.

    renewable bool

    Whether the token is renewable or not.

    role_id str

    The ID of the role to log in with.

    secret_id str

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    accessor String

    The accessor for the token.

    backend String

    The unique path of the Vault backend to log in with.

    clientToken String

    The Vault token created.

    leaseDuration Number

    How long the token is valid for, in seconds.

    leaseStarted String

    The date and time the lease started, in RFC 3339 format.

    metadata Map<String>

    The metadata associated with the token.

    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.

    policies List<String>

    A list of policies applied to the token.

    renewable Boolean

    Whether the token is renewable or not.

    roleId String

    The ID of the role to log in with.

    secretId String

    The secret ID of the role to log in with. Required unless bind_secret_id is set to false on the role.

    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 v5.15.1 published on Tuesday, Sep 26, 2023 by Pulumi