TemplateArgs

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",
},
});
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",
})
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" },
},
});
});
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
})
}
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());
}
}
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

Constructors

Link copied to clipboard
constructor(alphabet: Output<String>? = null, decodeFormats: Output<Map<String, String>>? = null, encodeFormat: Output<String>? = null, name: Output<String>? = null, namespace: Output<String>? = null, path: Output<String>? = null, pattern: Output<String>? = null, type: Output<String>? = null)

Properties

Link copied to clipboard
val alphabet: Output<String>? = null

The alphabet to use for this template. This is only used during FPE transformations.

Link copied to clipboard
val decodeFormats: Output<Map<String, String>>? = null

Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)

Link copied to clipboard
val encodeFormat: Output<String>? = null

The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)

Link copied to clipboard
val name: Output<String>? = null

The name of the template.

Link copied to clipboard
val namespace: Output<String>? = null

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.

Link copied to clipboard
val path: Output<String>? = null

Path to where the back-end is mounted within Vault.

Link copied to clipboard
val pattern: Output<String>? = null

The pattern used for matching. Currently, only regular expression pattern is supported.

Link copied to clipboard
val type: Output<String>? = null

The pattern type to use for match detection. Currently, only regex is supported.

Functions

Link copied to clipboard
open override fun toJava(): TemplateArgs