getSecretSubkeysV2

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 awsSecret = new vault.kv.SecretV2("aws_secret", {
mount: kvv2.path,
name: "aws_secret",
dataJson: JSON.stringify({
zip: "zap",
foo: "bar",
}),
});
const test = vault.kv.getSecretSubkeysV2Output({
mount: kvv2.path,
name: awsSecret.name,
});
import pulumi
import json
import pulumi_vault as vault
kvv2 = vault.Mount("kvv2",
path="kvv2",
type="kv",
options={
"version": "2",
},
description="KV Version 2 secret engine mount")
aws_secret = vault.kv.SecretV2("aws_secret",
mount=kvv2.path,
name="aws_secret",
data_json=json.dumps({
"zip": "zap",
"foo": "bar",
}))
test = vault.kv.get_secret_subkeys_v2_output(mount=kvv2.path,
name=aws_secret.name)
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
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 awsSecret = new Vault.Kv.SecretV2("aws_secret", new()
{
Mount = kvv2.Path,
Name = "aws_secret",
DataJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["zip"] = "zap",
["foo"] = "bar",
}),
});
var test = Vault.kv.GetSecretSubkeysV2.Invoke(new()
{
Mount = kvv2.Path,
Name = awsSecret.Name,
});
});
package main
import (
"encoding/json"
"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
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"zip": "zap",
"foo": "bar",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
awsSecret, err := kv.NewSecretV2(ctx, "aws_secret", &kv.SecretV2Args{
Mount: kvv2.Path,
Name: pulumi.String("aws_secret"),
DataJson: pulumi.String(json0),
})
if err != nil {
return err
}
_ = kv.GetSecretSubkeysV2Output(ctx, kv.GetSecretSubkeysV2OutputArgs{
Mount: kvv2.Path,
Name: awsSecret.Name,
}, nil)
return nil
})
}
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.SecretV2;
import com.pulumi.vault.kv.SecretV2Args;
import com.pulumi.vault.kv.KvFunctions;
import com.pulumi.vault.kv.inputs.GetSecretSubkeysV2Args;
import static com.pulumi.codegen.internal.Serialization.*;
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 awsSecret = new SecretV2("awsSecret", SecretV2Args.builder()
.mount(kvv2.path())
.name("aws_secret")
.dataJson(serializeJson(
jsonObject(
jsonProperty("zip", "zap"),
jsonProperty("foo", "bar")
)))
.build());
final var test = KvFunctions.getSecretSubkeysV2(GetSecretSubkeysV2Args.builder()
.mount(kvv2.path())
.name(awsSecret.name())
.build());
}
}
resources:
kvv2:
type: vault:Mount
properties:
path: kvv2
type: kv
options:
version: '2'
description: KV Version 2 secret engine mount
awsSecret:
type: vault:kv:SecretV2
name: aws_secret
properties:
mount: ${kvv2.path}
name: aws_secret
dataJson:
fn::toJSON:
zip: zap
foo: bar
variables:
test:
fn::invoke:
function: vault:kv:getSecretSubkeysV2
arguments:
mount: ${kvv2.path}
name: ${awsSecret.name}

Required Vault Capabilities

Use of this resource requires the read capability on the given path.

Return

A collection of values returned by getSecretSubkeysV2.

Parameters

argument

A collection of arguments for invoking getSecretSubkeysV2.


suspend fun getSecretSubkeysV2(depth: Int? = null, mount: String, name: String, namespace: String? = null, version: Int? = null): GetSecretSubkeysV2Result

Return

A collection of values returned by getSecretSubkeysV2.

Parameters

depth

Specifies the deepest nesting level to provide in the output. If non-zero, keys that reside at the specified depth value will be artificially treated as leaves and will thus be null even if further underlying sub-keys exist.

mount

Path where KV-V2 engine is mounted.

name

Full name of the secret. For a nested secret the name is the nested path excluding the mount and data prefix. For example, for a secret at kvv2/data/foo/bar/baz the name is foo/bar/baz.

namespace

The namespace of the target resource. 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.

version

Specifies the version to return. If not set the latest version is returned.

See also


Return

A collection of values returned by getSecretSubkeysV2.

Parameters

argument

Builder for com.pulumi.vault.kv.kotlin.inputs.GetSecretSubkeysV2PlainArgs.

See also