1. Packages
  2. HashiCorp Vault
  3. API Docs
  4. transform
  5. Template
HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi

vault.transform.Template

Explore with Pulumi AI

vault logo
HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi

    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,
        alphabet: "0123456789",
    });
    const test = new vault.transform.Template("test", {
        path: numerics.path,
        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,
        alphabet="0123456789")
    test = vault.transform.Template("test",
        path=numerics.path,
        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",
        })
    
    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,
    			Alphabet: pulumi.String("0123456789"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = transform.NewTemplate(ctx, "test", &transform.TemplateArgs{
    			Path:         numerics.Path,
    			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.Map{
    				"last-four-digits": pulumi.Any("$4"),
    			},
    		})
    		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 transform = new Vault.Mount("transform", new()
        {
            Path = "transform",
            Type = "transform",
        });
    
        var numerics = new Vault.Transform.Alphabet("numerics", new()
        {
            Path = transform.Path,
            AlphabetSet = "0123456789",
        });
    
        var test = new Vault.Transform.Template("test", new()
        {
            Path = numerics.Path,
            Type = "regex",
            Pattern = "(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})",
            Alphabet = "numerics",
            EncodeFormat = "$1-$2-$3-$4",
            DecodeFormats = 
            {
                { "last-four-digits", "$4" },
            },
        });
    
    });
    
    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())
                .alphabet("0123456789")
                .build());
    
            var test = new Template("test", TemplateArgs.builder()        
                .path(numerics.path())
                .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}
          alphabet: '0123456789'
      test:
        type: vault:transform:Template
        properties:
          path: ${numerics.path}
          type: regex
          pattern: (\d{4})[- ](\d{4})[- ](\d{4})[- ](\d{4})
          alphabet: numerics
          encodeFormat: $1-$2-$3-$4
          decodeFormats:
            last-four-digits: $4
    

    Create Template Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Template(name: string, args: TemplateArgs, opts?: CustomResourceOptions);
    @overload
    def Template(resource_name: str,
                 args: TemplateArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Template(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 path: Optional[str] = None,
                 alphabet: Optional[str] = None,
                 decode_formats: Optional[Mapping[str, Any]] = None,
                 encode_format: Optional[str] = None,
                 name: Optional[str] = None,
                 namespace: Optional[str] = None,
                 pattern: Optional[str] = None,
                 type: Optional[str] = None)
    func NewTemplate(ctx *Context, name string, args TemplateArgs, opts ...ResourceOption) (*Template, error)
    public Template(string name, TemplateArgs args, CustomResourceOptions? opts = null)
    public Template(String name, TemplateArgs args)
    public Template(String name, TemplateArgs args, CustomResourceOptions options)
    
    type: vault:transform:Template
    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 TemplateArgs
    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 TemplateArgs
    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 TemplateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TemplateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TemplateArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var templateResource = new Vault.Transform.Template("templateResource", new()
    {
        Path = "string",
        Alphabet = "string",
        DecodeFormats = 
        {
            { "string", "any" },
        },
        EncodeFormat = "string",
        Name = "string",
        Namespace = "string",
        Pattern = "string",
        Type = "string",
    });
    
    example, err := transform.NewTemplate(ctx, "templateResource", &transform.TemplateArgs{
    	Path:     pulumi.String("string"),
    	Alphabet: pulumi.String("string"),
    	DecodeFormats: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	EncodeFormat: pulumi.String("string"),
    	Name:         pulumi.String("string"),
    	Namespace:    pulumi.String("string"),
    	Pattern:      pulumi.String("string"),
    	Type:         pulumi.String("string"),
    })
    
    var templateResource = new Template("templateResource", TemplateArgs.builder()        
        .path("string")
        .alphabet("string")
        .decodeFormats(Map.of("string", "any"))
        .encodeFormat("string")
        .name("string")
        .namespace("string")
        .pattern("string")
        .type("string")
        .build());
    
    template_resource = vault.transform.Template("templateResource",
        path="string",
        alphabet="string",
        decode_formats={
            "string": "any",
        },
        encode_format="string",
        name="string",
        namespace="string",
        pattern="string",
        type="string")
    
    const templateResource = new vault.transform.Template("templateResource", {
        path: "string",
        alphabet: "string",
        decodeFormats: {
            string: "any",
        },
        encodeFormat: "string",
        name: "string",
        namespace: "string",
        pattern: "string",
        type: "string",
    });
    
    type: vault:transform:Template
    properties:
        alphabet: string
        decodeFormats:
            string: any
        encodeFormat: string
        name: string
        namespace: string
        path: string
        pattern: string
        type: string
    

    Template Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Template resource accepts the following input properties:

    Path string
    Path to where the back-end is mounted within Vault.
    Alphabet string
    The alphabet to use for this template. This is only used during FPE transformations.
    DecodeFormats Dictionary<string, object>
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    EncodeFormat string
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    Name string
    The name of the template.
    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.
    Pattern string
    The pattern used for matching. Currently, only regular expression pattern is supported.
    Type string
    The pattern type to use for match detection. Currently, only regex is supported.
    Path string
    Path to where the back-end is mounted within Vault.
    Alphabet string
    The alphabet to use for this template. This is only used during FPE transformations.
    DecodeFormats map[string]interface{}
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    EncodeFormat string
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    Name string
    The name of the template.
    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.
    Pattern string
    The pattern used for matching. Currently, only regular expression pattern is supported.
    Type string
    The pattern type to use for match detection. Currently, only regex is supported.
    path String
    Path to where the back-end is mounted within Vault.
    alphabet String
    The alphabet to use for this template. This is only used during FPE transformations.
    decodeFormats Map<String,Object>
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encodeFormat String
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name String
    The name of the template.
    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.
    pattern String
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type String
    The pattern type to use for match detection. Currently, only regex is supported.
    path string
    Path to where the back-end is mounted within Vault.
    alphabet string
    The alphabet to use for this template. This is only used during FPE transformations.
    decodeFormats {[key: string]: any}
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encodeFormat string
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name string
    The name of the template.
    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.
    pattern string
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type string
    The pattern type to use for match detection. Currently, only regex is supported.
    path str
    Path to where the back-end is mounted within Vault.
    alphabet str
    The alphabet to use for this template. This is only used during FPE transformations.
    decode_formats Mapping[str, Any]
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encode_format str
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name str
    The name of the template.
    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.
    pattern str
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type str
    The pattern type to use for match detection. Currently, only regex is supported.
    path String
    Path to where the back-end is mounted within Vault.
    alphabet String
    The alphabet to use for this template. This is only used during FPE transformations.
    decodeFormats Map<Any>
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encodeFormat String
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name String
    The name of the template.
    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.
    pattern String
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type String
    The pattern type to use for match detection. Currently, only regex is supported.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Template 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 Template Resource

    Get an existing Template 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?: TemplateState, opts?: CustomResourceOptions): Template
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            alphabet: Optional[str] = None,
            decode_formats: Optional[Mapping[str, Any]] = None,
            encode_format: Optional[str] = None,
            name: Optional[str] = None,
            namespace: Optional[str] = None,
            path: Optional[str] = None,
            pattern: Optional[str] = None,
            type: Optional[str] = None) -> Template
    func GetTemplate(ctx *Context, name string, id IDInput, state *TemplateState, opts ...ResourceOption) (*Template, error)
    public static Template Get(string name, Input<string> id, TemplateState? state, CustomResourceOptions? opts = null)
    public static Template get(String name, Output<String> id, TemplateState 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.
    The following state arguments are supported:
    Alphabet string
    The alphabet to use for this template. This is only used during FPE transformations.
    DecodeFormats Dictionary<string, object>
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    EncodeFormat string
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    Name string
    The name of the template.
    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.
    Path string
    Path to where the back-end is mounted within Vault.
    Pattern string
    The pattern used for matching. Currently, only regular expression pattern is supported.
    Type string
    The pattern type to use for match detection. Currently, only regex is supported.
    Alphabet string
    The alphabet to use for this template. This is only used during FPE transformations.
    DecodeFormats map[string]interface{}
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    EncodeFormat string
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    Name string
    The name of the template.
    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.
    Path string
    Path to where the back-end is mounted within Vault.
    Pattern string
    The pattern used for matching. Currently, only regular expression pattern is supported.
    Type string
    The pattern type to use for match detection. Currently, only regex is supported.
    alphabet String
    The alphabet to use for this template. This is only used during FPE transformations.
    decodeFormats Map<String,Object>
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encodeFormat String
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name String
    The name of the template.
    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.
    path String
    Path to where the back-end is mounted within Vault.
    pattern String
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type String
    The pattern type to use for match detection. Currently, only regex is supported.
    alphabet string
    The alphabet to use for this template. This is only used during FPE transformations.
    decodeFormats {[key: string]: any}
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encodeFormat string
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name string
    The name of the template.
    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.
    path string
    Path to where the back-end is mounted within Vault.
    pattern string
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type string
    The pattern type to use for match detection. Currently, only regex is supported.
    alphabet str
    The alphabet to use for this template. This is only used during FPE transformations.
    decode_formats Mapping[str, Any]
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encode_format str
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name str
    The name of the template.
    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.
    path str
    Path to where the back-end is mounted within Vault.
    pattern str
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type str
    The pattern type to use for match detection. Currently, only regex is supported.
    alphabet String
    The alphabet to use for this template. This is only used during FPE transformations.
    decodeFormats Map<Any>
    Optional mapping of name to regular expression template, used to customize the decoded output. (requires Vault Enterprise 1.9+)
    encodeFormat String
    The regular expression template used to format encoded values. (requires Vault Enterprise 1.9+)
    name String
    The name of the template.
    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.
    path String
    Path to where the back-end is mounted within Vault.
    pattern String
    The pattern used for matching. Currently, only regular expression pattern is supported.
    type String
    The pattern type to use for match detection. Currently, only regex is supported.

    Package Details

    Repository
    Vault pulumi/pulumi-vault
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vault Terraform Provider.
    vault logo
    HashiCorp Vault v6.1.0 published on Thursday, Apr 4, 2024 by Pulumi