vault.Token
Explore with Pulumi AI
Import
Tokens can be imported using its id
as accessor id, e.g.
$ pulumi import vault:index/token:Token example <accessor_id>
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;
return await Deployment.RunAsync(() =>
{
var example = new Vault.Token("example", new()
{
Metadata =
{
{ "purpose", "service-account" },
},
Policies = new[]
{
"policy1",
"policy2",
},
RenewIncrement = 86400,
RenewMinLease = 43200,
Renewable = true,
RoleName = "app",
Ttl = "24h",
});
});
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v5/go/vault"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := vault.NewToken(ctx, "example", &vault.TokenArgs{
Metadata: pulumi.StringMap{
"purpose": pulumi.String("service-account"),
},
Policies: pulumi.StringArray{
pulumi.String("policy1"),
pulumi.String("policy2"),
},
RenewIncrement: pulumi.Int(86400),
RenewMinLease: pulumi.Int(43200),
Renewable: pulumi.Bool(true),
RoleName: pulumi.String("app"),
Ttl: pulumi.String("24h"),
})
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.Token;
import com.pulumi.vault.TokenArgs;
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 example = new Token("example", TokenArgs.builder()
.metadata(Map.of("purpose", "service-account"))
.policies(
"policy1",
"policy2")
.renewIncrement(86400)
.renewMinLease(43200)
.renewable(true)
.roleName("app")
.ttl("24h")
.build());
}
}
import pulumi
import pulumi_vault as vault
example = vault.Token("example",
metadata={
"purpose": "service-account",
},
policies=[
"policy1",
"policy2",
],
renew_increment=86400,
renew_min_lease=43200,
renewable=True,
role_name="app",
ttl="24h")
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const example = new vault.Token("example", {
metadata: {
purpose: "service-account",
},
policies: [
"policy1",
"policy2",
],
renewIncrement: 86400,
renewMinLease: 43200,
renewable: true,
roleName: "app",
ttl: "24h",
});
resources:
example:
type: vault:Token
properties:
metadata:
purpose: service-account
policies:
- policy1
- policy2
renewIncrement: 86400
renewMinLease: 43200
renewable: true
roleName: app
ttl: 24h
Create Token Resource
new Token(name: string, args?: TokenArgs, opts?: CustomResourceOptions);
@overload
def Token(resource_name: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
explicit_max_ttl: Optional[str] = None,
metadata: Optional[Mapping[str, str]] = None,
namespace: Optional[str] = None,
no_default_policy: Optional[bool] = None,
no_parent: Optional[bool] = None,
num_uses: Optional[int] = None,
period: Optional[str] = None,
policies: Optional[Sequence[str]] = None,
renew_increment: Optional[int] = None,
renew_min_lease: Optional[int] = None,
renewable: Optional[bool] = None,
role_name: Optional[str] = None,
ttl: Optional[str] = None,
wrapping_ttl: Optional[str] = None)
@overload
def Token(resource_name: str,
args: Optional[TokenArgs] = None,
opts: Optional[ResourceOptions] = None)
func NewToken(ctx *Context, name string, args *TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs? args = null, CustomResourceOptions? opts = null)
type: vault:Token
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TokenArgs
- 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 TokenArgs
- 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 TokenArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Token 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 Token resource accepts the following input properties:
- Display
Name string String containing the token display name
- Explicit
Max stringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Metadata Dictionary<string, string>
Metadata to be set on this 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.- No
Default boolPolicy Flag to not attach the default policy to this token
- No
Parent bool Flag to create a token without parent
- Num
Uses int The number of allowed uses of this token
- Period string
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Policies List<string>
List of policies to attach to this token
- Renew
Increment int The renew increment. This is specified in seconds
- Renew
Min intLease The minimal lease to renew this token
- Renewable bool
Flag to allow to renew this token
- Role
Name string The token role name
- Ttl string
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Wrapping
Ttl string The TTL period of the wrapped token.
- Display
Name string String containing the token display name
- Explicit
Max stringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Metadata map[string]string
Metadata to be set on this 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.- No
Default boolPolicy Flag to not attach the default policy to this token
- No
Parent bool Flag to create a token without parent
- Num
Uses int The number of allowed uses of this token
- Period string
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Policies []string
List of policies to attach to this token
- Renew
Increment int The renew increment. This is specified in seconds
- Renew
Min intLease The minimal lease to renew this token
- Renewable bool
Flag to allow to renew this token
- Role
Name string The token role name
- Ttl string
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Wrapping
Ttl string The TTL period of the wrapped token.
- display
Name String String containing the token display name
- explicit
Max StringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- metadata Map<String,String>
Metadata to be set on this 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.- no
Default BooleanPolicy Flag to not attach the default policy to this token
- no
Parent Boolean Flag to create a token without parent
- num
Uses Integer The number of allowed uses of this token
- period String
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies List<String>
List of policies to attach to this token
- renew
Increment Integer The renew increment. This is specified in seconds
- renew
Min IntegerLease The minimal lease to renew this token
- renewable Boolean
Flag to allow to renew this token
- role
Name String The token role name
- ttl String
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapping
Ttl String The TTL period of the wrapped token.
- display
Name string String containing the token display name
- explicit
Max stringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- metadata {[key: string]: string}
Metadata to be set on this 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.- no
Default booleanPolicy Flag to not attach the default policy to this token
- no
Parent boolean Flag to create a token without parent
- num
Uses number The number of allowed uses of this token
- period string
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies string[]
List of policies to attach to this token
- renew
Increment number The renew increment. This is specified in seconds
- renew
Min numberLease The minimal lease to renew this token
- renewable boolean
Flag to allow to renew this token
- role
Name string The token role name
- ttl string
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapping
Ttl string The TTL period of the wrapped token.
- display_
name str String containing the token display name
- explicit_
max_ strttl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- metadata Mapping[str, str]
Metadata to be set on this 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.- no_
default_ boolpolicy Flag to not attach the default policy to this token
- no_
parent bool Flag to create a token without parent
- num_
uses int The number of allowed uses of this token
- period str
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies Sequence[str]
List of policies to attach to this token
- renew_
increment int The renew increment. This is specified in seconds
- renew_
min_ intlease The minimal lease to renew this token
- renewable bool
Flag to allow to renew this token
- role_
name str The token role name
- ttl str
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapping_
ttl str The TTL period of the wrapped token.
- display
Name String String containing the token display name
- explicit
Max StringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- metadata Map<String>
Metadata to be set on this 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.- no
Default BooleanPolicy Flag to not attach the default policy to this token
- no
Parent Boolean Flag to create a token without parent
- num
Uses Number The number of allowed uses of this token
- period String
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies List<String>
List of policies to attach to this token
- renew
Increment Number The renew increment. This is specified in seconds
- renew
Min NumberLease The minimal lease to renew this token
- renewable Boolean
Flag to allow to renew this token
- role
Name String The token role name
- ttl String
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapping
Ttl String The TTL period of the wrapped token.
Outputs
All input properties are implicitly available as output properties. Additionally, the Token resource produces the following output properties:
- Client
Token string String containing the client token if stored in present file
- Id string
The provider-assigned unique ID for this managed resource.
- Lease
Duration int String containing the token lease duration if present in state file
- Lease
Started string String containing the token lease started time if present in state file
- Wrapped
Token string The client wrapped token.
- Wrapping
Accessor string The client wrapping accessor.
- Client
Token string String containing the client token if stored in present file
- Id string
The provider-assigned unique ID for this managed resource.
- Lease
Duration int String containing the token lease duration if present in state file
- Lease
Started string String containing the token lease started time if present in state file
- Wrapped
Token string The client wrapped token.
- Wrapping
Accessor string The client wrapping accessor.
- client
Token String String containing the client token if stored in present file
- id String
The provider-assigned unique ID for this managed resource.
- lease
Duration Integer String containing the token lease duration if present in state file
- lease
Started String String containing the token lease started time if present in state file
- wrapped
Token String The client wrapped token.
- wrapping
Accessor String The client wrapping accessor.
- client
Token string String containing the client token if stored in present file
- id string
The provider-assigned unique ID for this managed resource.
- lease
Duration number String containing the token lease duration if present in state file
- lease
Started string String containing the token lease started time if present in state file
- wrapped
Token string The client wrapped token.
- wrapping
Accessor string The client wrapping accessor.
- client_
token str String containing the client token if stored in present file
- id str
The provider-assigned unique ID for this managed resource.
- lease_
duration int String containing the token lease duration if present in state file
- lease_
started str String containing the token lease started time if present in state file
- wrapped_
token str The client wrapped token.
- wrapping_
accessor str The client wrapping accessor.
- client
Token String String containing the client token if stored in present file
- id String
The provider-assigned unique ID for this managed resource.
- lease
Duration Number String containing the token lease duration if present in state file
- lease
Started String String containing the token lease started time if present in state file
- wrapped
Token String The client wrapped token.
- wrapping
Accessor String The client wrapping accessor.
Look up Existing Token Resource
Get an existing Token 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?: TokenState, opts?: CustomResourceOptions): Token
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
client_token: Optional[str] = None,
display_name: Optional[str] = None,
explicit_max_ttl: Optional[str] = None,
lease_duration: Optional[int] = None,
lease_started: Optional[str] = None,
metadata: Optional[Mapping[str, str]] = None,
namespace: Optional[str] = None,
no_default_policy: Optional[bool] = None,
no_parent: Optional[bool] = None,
num_uses: Optional[int] = None,
period: Optional[str] = None,
policies: Optional[Sequence[str]] = None,
renew_increment: Optional[int] = None,
renew_min_lease: Optional[int] = None,
renewable: Optional[bool] = None,
role_name: Optional[str] = None,
ttl: Optional[str] = None,
wrapped_token: Optional[str] = None,
wrapping_accessor: Optional[str] = None,
wrapping_ttl: Optional[str] = None) -> Token
func GetToken(ctx *Context, name string, id IDInput, state *TokenState, opts ...ResourceOption) (*Token, error)
public static Token Get(string name, Input<string> id, TokenState? state, CustomResourceOptions? opts = null)
public static Token get(String name, Output<String> id, TokenState 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.
- Client
Token string String containing the client token if stored in present file
- Display
Name string String containing the token display name
- Explicit
Max stringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Lease
Duration int String containing the token lease duration if present in state file
- Lease
Started string String containing the token lease started time if present in state file
- Metadata Dictionary<string, string>
Metadata to be set on this 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.- No
Default boolPolicy Flag to not attach the default policy to this token
- No
Parent bool Flag to create a token without parent
- Num
Uses int The number of allowed uses of this token
- Period string
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Policies List<string>
List of policies to attach to this token
- Renew
Increment int The renew increment. This is specified in seconds
- Renew
Min intLease The minimal lease to renew this token
- Renewable bool
Flag to allow to renew this token
- Role
Name string The token role name
- Ttl string
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Wrapped
Token string The client wrapped token.
- Wrapping
Accessor string The client wrapping accessor.
- Wrapping
Ttl string The TTL period of the wrapped token.
- Client
Token string String containing the client token if stored in present file
- Display
Name string String containing the token display name
- Explicit
Max stringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Lease
Duration int String containing the token lease duration if present in state file
- Lease
Started string String containing the token lease started time if present in state file
- Metadata map[string]string
Metadata to be set on this 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.- No
Default boolPolicy Flag to not attach the default policy to this token
- No
Parent bool Flag to create a token without parent
- Num
Uses int The number of allowed uses of this token
- Period string
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Policies []string
List of policies to attach to this token
- Renew
Increment int The renew increment. This is specified in seconds
- Renew
Min intLease The minimal lease to renew this token
- Renewable bool
Flag to allow to renew this token
- Role
Name string The token role name
- Ttl string
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- Wrapped
Token string The client wrapped token.
- Wrapping
Accessor string The client wrapping accessor.
- Wrapping
Ttl string The TTL period of the wrapped token.
- client
Token String String containing the client token if stored in present file
- display
Name String String containing the token display name
- explicit
Max StringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- lease
Duration Integer String containing the token lease duration if present in state file
- lease
Started String String containing the token lease started time if present in state file
- metadata Map<String,String>
Metadata to be set on this 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.- no
Default BooleanPolicy Flag to not attach the default policy to this token
- no
Parent Boolean Flag to create a token without parent
- num
Uses Integer The number of allowed uses of this token
- period String
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies List<String>
List of policies to attach to this token
- renew
Increment Integer The renew increment. This is specified in seconds
- renew
Min IntegerLease The minimal lease to renew this token
- renewable Boolean
Flag to allow to renew this token
- role
Name String The token role name
- ttl String
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapped
Token String The client wrapped token.
- wrapping
Accessor String The client wrapping accessor.
- wrapping
Ttl String The TTL period of the wrapped token.
- client
Token string String containing the client token if stored in present file
- display
Name string String containing the token display name
- explicit
Max stringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- lease
Duration number String containing the token lease duration if present in state file
- lease
Started string String containing the token lease started time if present in state file
- metadata {[key: string]: string}
Metadata to be set on this 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.- no
Default booleanPolicy Flag to not attach the default policy to this token
- no
Parent boolean Flag to create a token without parent
- num
Uses number The number of allowed uses of this token
- period string
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies string[]
List of policies to attach to this token
- renew
Increment number The renew increment. This is specified in seconds
- renew
Min numberLease The minimal lease to renew this token
- renewable boolean
Flag to allow to renew this token
- role
Name string The token role name
- ttl string
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapped
Token string The client wrapped token.
- wrapping
Accessor string The client wrapping accessor.
- wrapping
Ttl string The TTL period of the wrapped token.
- client_
token str String containing the client token if stored in present file
- display_
name str String containing the token display name
- explicit_
max_ strttl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- lease_
duration int String containing the token lease duration if present in state file
- lease_
started str String containing the token lease started time if present in state file
- metadata Mapping[str, str]
Metadata to be set on this 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.- no_
default_ boolpolicy Flag to not attach the default policy to this token
- no_
parent bool Flag to create a token without parent
- num_
uses int The number of allowed uses of this token
- period str
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies Sequence[str]
List of policies to attach to this token
- renew_
increment int The renew increment. This is specified in seconds
- renew_
min_ intlease The minimal lease to renew this token
- renewable bool
Flag to allow to renew this token
- role_
name str The token role name
- ttl str
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapped_
token str The client wrapped token.
- wrapping_
accessor str The client wrapping accessor.
- wrapping_
ttl str The TTL period of the wrapped token.
- client
Token String String containing the client token if stored in present file
- display
Name String String containing the token display name
- explicit
Max StringTtl The explicit max TTL of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- lease
Duration Number String containing the token lease duration if present in state file
- lease
Started String String containing the token lease started time if present in state file
- metadata Map<String>
Metadata to be set on this 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.- no
Default BooleanPolicy Flag to not attach the default policy to this token
- no
Parent Boolean Flag to create a token without parent
- num
Uses Number The number of allowed uses of this token
- period String
The period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- policies List<String>
List of policies to attach to this token
- renew
Increment Number The renew increment. This is specified in seconds
- renew
Min NumberLease The minimal lease to renew this token
- renewable Boolean
Flag to allow to renew this token
- role
Name String The token role name
- ttl String
The TTL period of this token. This is specified as a numeric string with suffix like "30s" ro "5m"
- wrapped
Token String The client wrapped token.
- wrapping
Accessor String The client wrapping accessor.
- wrapping
Ttl String The TTL period of the wrapped token.
Package Details
- Repository
- Vault pulumi/pulumi-vault
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
vault
Terraform Provider.