Template Args
data class TemplateArgs(val alphabet: Output<String>? = null, val decodeFormats: Output<Map<String, String>>? = null, val encodeFormat: Output<String>? = null, val name: Output<String>? = null, val namespace: Output<String>? = null, val path: Output<String>? = null, val pattern: Output<String>? = null, val type: Output<String>? = null) : ConvertibleToJava<TemplateArgs>
This resource supports the /transform/template/{name}
Vault endpoint. It creates or updates a template with the given name. If a template with the name does not exist, it will be created. If the template exists, it will be updated with the new attributes.
Requires Vault Enterprise with the Advanced Data Protection Transform Module. See Transform Secrets Engine for more information.
Example Usage
Please note that the pattern
below holds a regex. The regex shown is identical to the one in our Setup docs, (\d{4})-(\d{4})-(\d{4})-(\d{4})
. However, due to HCL, the backslashes must be escaped to appear correctly in Vault. For further assistance escaping your own custom regex, see String Literals.
import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const transform = new vault.Mount("transform", {
path: "transform",
type: "transform",
});
const numerics = new vault.transform.Alphabet("numerics", {
path: transform.path,
name: "numerics",
alphabet: "0123456789",
});
const test = new vault.transform.Template("test", {
path: numerics.path,
name: "ccn",
type: "regex",
pattern: "(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
alphabet: "numerics",
encodeFormat: "$1-$2-$3-$4",
decodeFormats: {
"last-four-digits": "$4",
},
});
Content copied to clipboard
import pulumi
import pulumi_vault as vault
transform = vault.Mount("transform",
path="transform",
type="transform")
numerics = vault.transform.Alphabet("numerics",
path=transform.path,
name="numerics",
alphabet="0123456789")
test = vault.transform.Template("test",
path=numerics.path,
name="ccn",
type="regex",
pattern="(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
alphabet="numerics",
encode_format="$1-$2-$3-$4",
decode_formats={
"last-four-digits": "$4",
})
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;
return await Deployment.RunAsync(() =>
{
var transform = new Vault.Mount("transform", new()
{
Path = "transform",
Type = "transform",
});
var numerics = new Vault.Transform.Alphabet("numerics", new()
{
Path = transform.Path,
Name = "numerics",
AlphabetSet = "0123456789",
});
var test = new Vault.Transform.Template("test", new()
{
Path = numerics.Path,
Name = "ccn",
Type = "regex",
Pattern = "(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
Alphabet = "numerics",
EncodeFormat = "$1-$2-$3-$4",
DecodeFormats =
{
{ "last-four-digits", "$4" },
},
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/transform"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
transform, err := vault.NewMount(ctx, "transform", &vault.MountArgs{
Path: pulumi.String("transform"),
Type: pulumi.String("transform"),
})
if err != nil {
return err
}
numerics, err := transform.NewAlphabet(ctx, "numerics", &transform.AlphabetArgs{
Path: transform.Path,
Name: pulumi.String("numerics"),
Alphabet: pulumi.String("0123456789"),
})
if err != nil {
return err
}
_, err = transform.NewTemplate(ctx, "test", &transform.TemplateArgs{
Path: numerics.Path,
Name: pulumi.String("ccn"),
Type: pulumi.String("regex"),
Pattern: pulumi.String("(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})"),
Alphabet: pulumi.String("numerics"),
EncodeFormat: pulumi.String("$1-$2-$3-$4"),
DecodeFormats: pulumi.StringMap{
"last-four-digits": pulumi.String("$4"),
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
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.transform.Alphabet;
import com.pulumi.vault.transform.AlphabetArgs;
import com.pulumi.vault.transform.Template;
import com.pulumi.vault.transform.TemplateArgs;
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 transform = new Mount("transform", MountArgs.builder()
.path("transform")
.type("transform")
.build());
var numerics = new Alphabet("numerics", AlphabetArgs.builder()
.path(transform.path())
.name("numerics")
.alphabet("0123456789")
.build());
var test = new Template("test", TemplateArgs.builder()
.path(numerics.path())
.name("ccn")
.type("regex")
.pattern("(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})")
.alphabet("numerics")
.encodeFormat("$1-$2-$3-$4")
.decodeFormats(Map.of("last-four-digits", "$4"))
.build());
}
}
Content copied to clipboard
resources:
transform:
type: vault:Mount
properties:
path: transform
type: transform
numerics:
type: vault:transform:Alphabet
properties:
path: ${transform.path}
name: numerics
alphabet: '0123456789'
test:
type: vault:transform:Template
properties:
path: ${numerics.path}
name: ccn
type: regex
pattern: (\d{4})[- ](\d{4})[- ](\d{4})[- ](\d{4})
alphabet: numerics
encodeFormat: $1-$2-$3-$4
decodeFormats:
last-four-digits: $4
Content copied to clipboard