vault.kv.SecretBackendV2
Explore with Pulumi AI
Configures KV-V2 backend level settings that are applied to every key in the key-value store.
For more information on Vault’s KV-V2 secret backend see here.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const kvv2 = new vault.Mount("kvv2", {
path: "kvv2",
type: "kv",
options: {
version: "2",
},
description: "KV Version 2 secret engine mount",
});
const example = new vault.kv.SecretBackendV2("example", {
mount: kvv2.path,
maxVersions: 5,
deleteVersionAfter: 12600,
casRequired: true,
});
import pulumi
import pulumi_vault as vault
kvv2 = vault.Mount("kvv2",
path="kvv2",
type="kv",
options={
"version": "2",
},
description="KV Version 2 secret engine mount")
example = vault.kv.SecretBackendV2("example",
mount=kvv2.path,
max_versions=5,
delete_version_after=12600,
cas_required=True)
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/kv"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
kvv2, err := vault.NewMount(ctx, "kvv2", &vault.MountArgs{
Path: pulumi.String("kvv2"),
Type: pulumi.String("kv"),
Options: pulumi.StringMap{
"version": pulumi.String("2"),
},
Description: pulumi.String("KV Version 2 secret engine mount"),
})
if err != nil {
return err
}
_, err = kv.NewSecretBackendV2(ctx, "example", &kv.SecretBackendV2Args{
Mount: kvv2.Path,
MaxVersions: pulumi.Int(5),
DeleteVersionAfter: pulumi.Int(12600),
CasRequired: pulumi.Bool(true),
})
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 kvv2 = new Vault.Mount("kvv2", new()
{
Path = "kvv2",
Type = "kv",
Options =
{
{ "version", "2" },
},
Description = "KV Version 2 secret engine mount",
});
var example = new Vault.Kv.SecretBackendV2("example", new()
{
Mount = kvv2.Path,
MaxVersions = 5,
DeleteVersionAfter = 12600,
CasRequired = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.Mount;
import com.pulumi.vault.MountArgs;
import com.pulumi.vault.kv.SecretBackendV2;
import com.pulumi.vault.kv.SecretBackendV2Args;
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 kvv2 = new Mount("kvv2", MountArgs.builder()
.path("kvv2")
.type("kv")
.options(Map.of("version", "2"))
.description("KV Version 2 secret engine mount")
.build());
var example = new SecretBackendV2("example", SecretBackendV2Args.builder()
.mount(kvv2.path())
.maxVersions(5)
.deleteVersionAfter(12600)
.casRequired(true)
.build());
}
}
resources:
kvv2:
type: vault:Mount
properties:
path: kvv2
type: kv
options:
version: '2'
description: KV Version 2 secret engine mount
example:
type: vault:kv:SecretBackendV2
properties:
mount: ${kvv2.path}
maxVersions: 5
deleteVersionAfter: 12600
casRequired: true
Required Vault Capabilities
Use of this resource requires the create
or update
capability
(depending on whether the resource already exists) on the given path,
the delete
capability if the resource is removed from configuration,
and the read
capability for drift detection (by default).
Create SecretBackendV2 Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SecretBackendV2(name: string, args: SecretBackendV2Args, opts?: CustomResourceOptions);
@overload
def SecretBackendV2(resource_name: str,
args: SecretBackendV2Args,
opts: Optional[ResourceOptions] = None)
@overload
def SecretBackendV2(resource_name: str,
opts: Optional[ResourceOptions] = None,
mount: Optional[str] = None,
cas_required: Optional[bool] = None,
delete_version_after: Optional[int] = None,
max_versions: Optional[int] = None,
namespace: Optional[str] = None)
func NewSecretBackendV2(ctx *Context, name string, args SecretBackendV2Args, opts ...ResourceOption) (*SecretBackendV2, error)
public SecretBackendV2(string name, SecretBackendV2Args args, CustomResourceOptions? opts = null)
public SecretBackendV2(String name, SecretBackendV2Args args)
public SecretBackendV2(String name, SecretBackendV2Args args, CustomResourceOptions options)
type: vault:kv:SecretBackendV2
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 SecretBackendV2Args
- 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 SecretBackendV2Args
- 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 SecretBackendV2Args
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecretBackendV2Args
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecretBackendV2Args
- 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 secretBackendV2Resource = new Vault.Kv.SecretBackendV2("secretBackendV2Resource", new()
{
Mount = "string",
CasRequired = false,
DeleteVersionAfter = 0,
MaxVersions = 0,
Namespace = "string",
});
example, err := kv.NewSecretBackendV2(ctx, "secretBackendV2Resource", &kv.SecretBackendV2Args{
Mount: pulumi.String("string"),
CasRequired: pulumi.Bool(false),
DeleteVersionAfter: pulumi.Int(0),
MaxVersions: pulumi.Int(0),
Namespace: pulumi.String("string"),
})
var secretBackendV2Resource = new SecretBackendV2("secretBackendV2Resource", SecretBackendV2Args.builder()
.mount("string")
.casRequired(false)
.deleteVersionAfter(0)
.maxVersions(0)
.namespace("string")
.build());
secret_backend_v2_resource = vault.kv.SecretBackendV2("secretBackendV2Resource",
mount="string",
cas_required=False,
delete_version_after=0,
max_versions=0,
namespace="string")
const secretBackendV2Resource = new vault.kv.SecretBackendV2("secretBackendV2Resource", {
mount: "string",
casRequired: false,
deleteVersionAfter: 0,
maxVersions: 0,
namespace: "string",
});
type: vault:kv:SecretBackendV2
properties:
casRequired: false
deleteVersionAfter: 0
maxVersions: 0
mount: string
namespace: string
SecretBackendV2 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 SecretBackendV2 resource accepts the following input properties:
- Mount string
- Path where KV-V2 engine is mounted.
- Cas
Required bool - If true, all keys will require the cas parameter to be set on all write requests.
- Delete
Version intAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- Max
Versions int - The number of versions to keep per key.
- 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.
- Mount string
- Path where KV-V2 engine is mounted.
- Cas
Required bool - If true, all keys will require the cas parameter to be set on all write requests.
- Delete
Version intAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- Max
Versions int - The number of versions to keep per key.
- 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.
- mount String
- Path where KV-V2 engine is mounted.
- cas
Required Boolean - If true, all keys will require the cas parameter to be set on all write requests.
- delete
Version IntegerAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max
Versions Integer - The number of versions to keep per key.
- 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.
- mount string
- Path where KV-V2 engine is mounted.
- cas
Required boolean - If true, all keys will require the cas parameter to be set on all write requests.
- delete
Version numberAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max
Versions number - The number of versions to keep per key.
- 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.
- mount str
- Path where KV-V2 engine is mounted.
- cas_
required bool - If true, all keys will require the cas parameter to be set on all write requests.
- delete_
version_ intafter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max_
versions int - The number of versions to keep per key.
- 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.
- mount String
- Path where KV-V2 engine is mounted.
- cas
Required Boolean - If true, all keys will require the cas parameter to be set on all write requests.
- delete
Version NumberAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max
Versions Number - The number of versions to keep per key.
- 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the SecretBackendV2 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 SecretBackendV2 Resource
Get an existing SecretBackendV2 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?: SecretBackendV2State, opts?: CustomResourceOptions): SecretBackendV2
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cas_required: Optional[bool] = None,
delete_version_after: Optional[int] = None,
max_versions: Optional[int] = None,
mount: Optional[str] = None,
namespace: Optional[str] = None) -> SecretBackendV2
func GetSecretBackendV2(ctx *Context, name string, id IDInput, state *SecretBackendV2State, opts ...ResourceOption) (*SecretBackendV2, error)
public static SecretBackendV2 Get(string name, Input<string> id, SecretBackendV2State? state, CustomResourceOptions? opts = null)
public static SecretBackendV2 get(String name, Output<String> id, SecretBackendV2State 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.
- Cas
Required bool - If true, all keys will require the cas parameter to be set on all write requests.
- Delete
Version intAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- Max
Versions int - The number of versions to keep per key.
- Mount string
- Path where KV-V2 engine is mounted.
- 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.
- Cas
Required bool - If true, all keys will require the cas parameter to be set on all write requests.
- Delete
Version intAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- Max
Versions int - The number of versions to keep per key.
- Mount string
- Path where KV-V2 engine is mounted.
- 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.
- cas
Required Boolean - If true, all keys will require the cas parameter to be set on all write requests.
- delete
Version IntegerAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max
Versions Integer - The number of versions to keep per key.
- mount String
- Path where KV-V2 engine is mounted.
- 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.
- cas
Required boolean - If true, all keys will require the cas parameter to be set on all write requests.
- delete
Version numberAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max
Versions number - The number of versions to keep per key.
- mount string
- Path where KV-V2 engine is mounted.
- 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.
- cas_
required bool - If true, all keys will require the cas parameter to be set on all write requests.
- delete_
version_ intafter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max_
versions int - The number of versions to keep per key.
- mount str
- Path where KV-V2 engine is mounted.
- 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.
- cas
Required Boolean - If true, all keys will require the cas parameter to be set on all write requests.
- delete
Version NumberAfter - If set, specifies the length of time before a version is deleted. Accepts duration in integer seconds.
- max
Versions Number - The number of versions to keep per key.
- mount String
- Path where KV-V2 engine is mounted.
- 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.
Import
The KV-V2 secret backend can be imported using its unique ID,
the ${mount}/config
, e.g.
$ pulumi import vault:kv/secretBackendV2:SecretBackendV2 example kvv2/config
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.