published on Tuesday, Mar 31, 2026 by Pulumi
published on Tuesday, Mar 31, 2026 by Pulumi
Reads arbitrary data from a given path in Vault.
This resource is primarily intended to be used with
Vault’s “generic” secret backend,
but it is also compatible with any other Vault endpoint that supports
the vault read command.
Important All data retrieved from Vault will be written in cleartext to state file generated by Terraform, will appear in the console output when Terraform runs, and may be included in plan files if secrets are interpolated into any resource attributes. Protect these artifacts accordingly. See the main provider documentation for more details.
Example Usage
Generic secret
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const rundeckAuth = vault.generic.getSecret({
path: "secret/rundeck_auth",
});
import pulumi
import pulumi_vault as vault
rundeck_auth = vault.generic.get_secret(path="secret/rundeck_auth")
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v7/go/vault/generic"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := generic.LookupSecret(ctx, &generic.LookupSecretArgs{
Path: "secret/rundeck_auth",
}, nil)
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 rundeckAuth = Vault.Generic.GetSecret.Invoke(new()
{
Path = "secret/rundeck_auth",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.generic.GenericFunctions;
import com.pulumi.vault.generic.inputs.GetSecretArgs;
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) {
final var rundeckAuth = GenericFunctions.getSecret(GetSecretArgs.builder()
.path("secret/rundeck_auth")
.build());
}
}
variables:
rundeckAuth:
fn::invoke:
function: vault:generic:getSecret
arguments:
path: secret/rundeck_auth
KV
For this example, consider example as a path for a KV engine.
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
function notImplemented(message: string) {
throw new Error(message);
}
const exampleCreds = vault.generic.getSecret({
path: "example/creds",
});
const exampleTemplate = notImplemented("The template_file data resource is not yet supported.");
import pulumi
import pulumi_vault as vault
def not_implemented(msg):
raise NotImplementedError(msg)
example_creds = vault.generic.get_secret(path="example/creds")
example_template = not_implemented("The template_file data resource is not yet supported.")
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v7/go/vault/generic"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func notImplemented(message string) pulumi.AnyOutput {
panic(message)
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := generic.LookupSecret(ctx, &generic.LookupSecretArgs{
Path: "example/creds",
}, nil)
if err != nil {
return err
}
_ = notImplemented("The template_file data resource is not yet supported.")
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;
object NotImplemented(string errorMessage)
{
throw new System.NotImplementedException(errorMessage);
}
return await Deployment.RunAsync(() =>
{
var exampleCreds = Vault.Generic.GetSecret.Invoke(new()
{
Path = "example/creds",
});
var exampleTemplate = NotImplemented("The template_file data resource is not yet supported.");
});
Example coming soon!
Example coming soon!
Required Vault Capabilities
Use of this resource requires the read capability on the given path.
Using getSecret
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSecret(args: GetSecretArgs, opts?: InvokeOptions): Promise<GetSecretResult>
function getSecretOutput(args: GetSecretOutputArgs, opts?: InvokeOptions): Output<GetSecretResult>def get_secret(namespace: Optional[str] = None,
path: Optional[str] = None,
version: Optional[int] = None,
with_lease_start_time: Optional[bool] = None,
opts: Optional[InvokeOptions] = None) -> GetSecretResult
def get_secret_output(namespace: Optional[pulumi.Input[str]] = None,
path: Optional[pulumi.Input[str]] = None,
version: Optional[pulumi.Input[int]] = None,
with_lease_start_time: Optional[pulumi.Input[bool]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSecretResult]func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)
func LookupSecretOutput(ctx *Context, args *LookupSecretOutputArgs, opts ...InvokeOption) LookupSecretResultOutput> Note: This function is named LookupSecret in the Go SDK.
public static class GetSecret
{
public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
public static Output<GetSecretResult> Invoke(GetSecretInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
public static Output<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
fn::invoke:
function: vault:generic/getSecret:getSecret
arguments:
# arguments dictionaryThe following arguments are supported:
- Path string
- The full logical path from which to request data.
To read data from the "generic" secret backend mounted in Vault by
default, this should be prefixed with
secret/. Reading from other backends with this data source is possible; consult each backend's documentation to see which endpoints support theGETmethod. - Namespace string
- The namespace of the target resource.
The value should not contain leading or trailing forward slashes.
The
namespaceis always relative to the provider's configured namespace. Available only for Vault Enterprise. - Version int
- The version of the secret to read. This is used by the Vault KV secrets engine - version 2 to indicate which version of the secret to read.
- With
Lease boolStart Time - If set to true, stores
leaseStartTimein the TF state. Note that storing theleaseStartTimein the TF state will cause a persistent drift on everypulumi previewand will require apulumi up.
- Path string
- The full logical path from which to request data.
To read data from the "generic" secret backend mounted in Vault by
default, this should be prefixed with
secret/. Reading from other backends with this data source is possible; consult each backend's documentation to see which endpoints support theGETmethod. - Namespace string
- The namespace of the target resource.
The value should not contain leading or trailing forward slashes.
The
namespaceis always relative to the provider's configured namespace. Available only for Vault Enterprise. - Version int
- The version of the secret to read. This is used by the Vault KV secrets engine - version 2 to indicate which version of the secret to read.
- With
Lease boolStart Time - If set to true, stores
leaseStartTimein the TF state. Note that storing theleaseStartTimein the TF state will cause a persistent drift on everypulumi previewand will require apulumi up.
- path String
- The full logical path from which to request data.
To read data from the "generic" secret backend mounted in Vault by
default, this should be prefixed with
secret/. Reading from other backends with this data source is possible; consult each backend's documentation to see which endpoints support theGETmethod. - namespace String
- The namespace of the target resource.
The value should not contain leading or trailing forward slashes.
The
namespaceis always relative to the provider's configured namespace. Available only for Vault Enterprise. - version Integer
- The version of the secret to read. This is used by the Vault KV secrets engine - version 2 to indicate which version of the secret to read.
- with
Lease BooleanStart Time - If set to true, stores
leaseStartTimein the TF state. Note that storing theleaseStartTimein the TF state will cause a persistent drift on everypulumi previewand will require apulumi up.
- path string
- The full logical path from which to request data.
To read data from the "generic" secret backend mounted in Vault by
default, this should be prefixed with
secret/. Reading from other backends with this data source is possible; consult each backend's documentation to see which endpoints support theGETmethod. - namespace string
- The namespace of the target resource.
The value should not contain leading or trailing forward slashes.
The
namespaceis always relative to the provider's configured namespace. Available only for Vault Enterprise. - version number
- The version of the secret to read. This is used by the Vault KV secrets engine - version 2 to indicate which version of the secret to read.
- with
Lease booleanStart Time - If set to true, stores
leaseStartTimein the TF state. Note that storing theleaseStartTimein the TF state will cause a persistent drift on everypulumi previewand will require apulumi up.
- path str
- The full logical path from which to request data.
To read data from the "generic" secret backend mounted in Vault by
default, this should be prefixed with
secret/. Reading from other backends with this data source is possible; consult each backend's documentation to see which endpoints support theGETmethod. - namespace str
- The namespace of the target resource.
The value should not contain leading or trailing forward slashes.
The
namespaceis always relative to the provider's configured namespace. Available only for Vault Enterprise. - version int
- The version of the secret to read. This is used by the Vault KV secrets engine - version 2 to indicate which version of the secret to read.
- with_
lease_ boolstart_ time - If set to true, stores
leaseStartTimein the TF state. Note that storing theleaseStartTimein the TF state will cause a persistent drift on everypulumi previewand will require apulumi up.
- path String
- The full logical path from which to request data.
To read data from the "generic" secret backend mounted in Vault by
default, this should be prefixed with
secret/. Reading from other backends with this data source is possible; consult each backend's documentation to see which endpoints support theGETmethod. - namespace String
- The namespace of the target resource.
The value should not contain leading or trailing forward slashes.
The
namespaceis always relative to the provider's configured namespace. Available only for Vault Enterprise. - version Number
- The version of the secret to read. This is used by the Vault KV secrets engine - version 2 to indicate which version of the secret to read.
- with
Lease BooleanStart Time - If set to true, stores
leaseStartTimein the TF state. Note that storing theleaseStartTimein the TF state will cause a persistent drift on everypulumi previewand will require apulumi up.
getSecret Result
The following output properties are available:
- Data Dictionary<string, string>
- A mapping whose keys are the top-level data keys returned from Vault and whose values are the corresponding values. This map can only represent string data, so any non-string values returned from Vault are serialized as JSON.
- Data
Json string - A string containing the full data payload retrieved from Vault, serialized in JSON format.
- Id string
- The provider-assigned unique ID for this managed resource.
- Lease
Duration int - The duration of the secret lease, in seconds relative to the time the data was requested. Once this time has passed any plan generated with this data may fail to apply.
- Lease
Id string - The lease identifier assigned by Vault, if any.
- Lease
Renewable bool trueif the lease can be renewed using Vault'ssys/renew/{lease-id}endpoint. Terraform does not currently support lease renewal, and so it will request a new lease each time this data source is refreshed.- Lease
Start stringTime - The date and time of Terraform execution.
It is derived from the local machine's clock, and is
recorded in RFC3339 format UTC.
This can be used to approximate the absolute time represented by
leaseDuration, though users must allow for any clock drift and response latency relative to the Vault server. Provided only as a convenience. - Path string
- Namespace string
- Version int
- With
Lease boolStart Time
- Data map[string]string
- A mapping whose keys are the top-level data keys returned from Vault and whose values are the corresponding values. This map can only represent string data, so any non-string values returned from Vault are serialized as JSON.
- Data
Json string - A string containing the full data payload retrieved from Vault, serialized in JSON format.
- Id string
- The provider-assigned unique ID for this managed resource.
- Lease
Duration int - The duration of the secret lease, in seconds relative to the time the data was requested. Once this time has passed any plan generated with this data may fail to apply.
- Lease
Id string - The lease identifier assigned by Vault, if any.
- Lease
Renewable bool trueif the lease can be renewed using Vault'ssys/renew/{lease-id}endpoint. Terraform does not currently support lease renewal, and so it will request a new lease each time this data source is refreshed.- Lease
Start stringTime - The date and time of Terraform execution.
It is derived from the local machine's clock, and is
recorded in RFC3339 format UTC.
This can be used to approximate the absolute time represented by
leaseDuration, though users must allow for any clock drift and response latency relative to the Vault server. Provided only as a convenience. - Path string
- Namespace string
- Version int
- With
Lease boolStart Time
- data Map<String,String>
- A mapping whose keys are the top-level data keys returned from Vault and whose values are the corresponding values. This map can only represent string data, so any non-string values returned from Vault are serialized as JSON.
- data
Json String - A string containing the full data payload retrieved from Vault, serialized in JSON format.
- id String
- The provider-assigned unique ID for this managed resource.
- lease
Duration Integer - The duration of the secret lease, in seconds relative to the time the data was requested. Once this time has passed any plan generated with this data may fail to apply.
- lease
Id String - The lease identifier assigned by Vault, if any.
- lease
Renewable Boolean trueif the lease can be renewed using Vault'ssys/renew/{lease-id}endpoint. Terraform does not currently support lease renewal, and so it will request a new lease each time this data source is refreshed.- lease
Start StringTime - The date and time of Terraform execution.
It is derived from the local machine's clock, and is
recorded in RFC3339 format UTC.
This can be used to approximate the absolute time represented by
leaseDuration, though users must allow for any clock drift and response latency relative to the Vault server. Provided only as a convenience. - path String
- namespace String
- version Integer
- with
Lease BooleanStart Time
- data {[key: string]: string}
- A mapping whose keys are the top-level data keys returned from Vault and whose values are the corresponding values. This map can only represent string data, so any non-string values returned from Vault are serialized as JSON.
- data
Json string - A string containing the full data payload retrieved from Vault, serialized in JSON format.
- id string
- The provider-assigned unique ID for this managed resource.
- lease
Duration number - The duration of the secret lease, in seconds relative to the time the data was requested. Once this time has passed any plan generated with this data may fail to apply.
- lease
Id string - The lease identifier assigned by Vault, if any.
- lease
Renewable boolean trueif the lease can be renewed using Vault'ssys/renew/{lease-id}endpoint. Terraform does not currently support lease renewal, and so it will request a new lease each time this data source is refreshed.- lease
Start stringTime - The date and time of Terraform execution.
It is derived from the local machine's clock, and is
recorded in RFC3339 format UTC.
This can be used to approximate the absolute time represented by
leaseDuration, though users must allow for any clock drift and response latency relative to the Vault server. Provided only as a convenience. - path string
- namespace string
- version number
- with
Lease booleanStart Time
- data Mapping[str, str]
- A mapping whose keys are the top-level data keys returned from Vault and whose values are the corresponding values. This map can only represent string data, so any non-string values returned from Vault are serialized as JSON.
- data_
json str - A string containing the full data payload retrieved from Vault, serialized in JSON format.
- id str
- The provider-assigned unique ID for this managed resource.
- lease_
duration int - The duration of the secret lease, in seconds relative to the time the data was requested. Once this time has passed any plan generated with this data may fail to apply.
- lease_
id str - The lease identifier assigned by Vault, if any.
- lease_
renewable bool trueif the lease can be renewed using Vault'ssys/renew/{lease-id}endpoint. Terraform does not currently support lease renewal, and so it will request a new lease each time this data source is refreshed.- lease_
start_ strtime - The date and time of Terraform execution.
It is derived from the local machine's clock, and is
recorded in RFC3339 format UTC.
This can be used to approximate the absolute time represented by
leaseDuration, though users must allow for any clock drift and response latency relative to the Vault server. Provided only as a convenience. - path str
- namespace str
- version int
- with_
lease_ boolstart_ time
- data Map<String>
- A mapping whose keys are the top-level data keys returned from Vault and whose values are the corresponding values. This map can only represent string data, so any non-string values returned from Vault are serialized as JSON.
- data
Json String - A string containing the full data payload retrieved from Vault, serialized in JSON format.
- id String
- The provider-assigned unique ID for this managed resource.
- lease
Duration Number - The duration of the secret lease, in seconds relative to the time the data was requested. Once this time has passed any plan generated with this data may fail to apply.
- lease
Id String - The lease identifier assigned by Vault, if any.
- lease
Renewable Boolean trueif the lease can be renewed using Vault'ssys/renew/{lease-id}endpoint. Terraform does not currently support lease renewal, and so it will request a new lease each time this data source is refreshed.- lease
Start StringTime - The date and time of Terraform execution.
It is derived from the local machine's clock, and is
recorded in RFC3339 format UTC.
This can be used to approximate the absolute time represented by
leaseDuration, though users must allow for any clock drift and response latency relative to the Vault server. Provided only as a convenience. - path String
- namespace String
- version Number
- with
Lease BooleanStart Time
Package Details
- Repository
- Vault pulumi/pulumi-vault
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vaultTerraform Provider.
published on Tuesday, Mar 31, 2026 by Pulumi
