1. Packages
  2. Packages
  3. HashiCorp Vault Provider
  4. API Docs
  5. Namespace
Viewing docs for HashiCorp Vault v7.8.0
published on Tuesday, Mar 31, 2026 by Pulumi
vault logo
Viewing docs for HashiCorp Vault v7.8.0
published on Tuesday, Mar 31, 2026 by Pulumi

    Provides a resource to manage Namespaces.

    Note this feature is available only with Vault Enterprise.

    Example Usage

    Single namespace

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const ns1 = new vault.Namespace("ns1", {path: "ns1"});
    
    import pulumi
    import pulumi_vault as vault
    
    ns1 = vault.Namespace("ns1", path="ns1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v7/go/vault"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vault.NewNamespace(ctx, "ns1", &vault.NamespaceArgs{
    			Path: pulumi.String("ns1"),
    		})
    		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 ns1 = new Vault.Namespace("ns1", new()
        {
            Path = "ns1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.Namespace;
    import com.pulumi.vault.NamespaceArgs;
    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 ns1 = new Namespace("ns1", NamespaceArgs.builder()
                .path("ns1")
                .build());
    
        }
    }
    
    resources:
      ns1:
        type: vault:Namespace
        properties:
          path: ns1
    
    Example coming soon!
    

    Nested namespaces

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const config = new pulumi.Config();
    const childNamespaces = config.getObject<Array<string>>("childNamespaces") || [
        "child_0",
        "child_1",
        "child_2",
    ];
    const parent = new vault.Namespace("parent", {path: "parent"});
    const children: vault.Namespace[] = [];
    for (const range of childNamespaces.map((v, k) => ({key: k, value: v}))) {
        children.push(new vault.Namespace(`children-${range.key}`, {
            namespace: parent.path,
            path: range.key,
        }));
    }
    const childrenMount: vault.Mount[] = [];
    children.apply(rangeBody => {
        for (const range of rangeBody.map((v, k) => ({key: k, value: v}))) {
            childrenMount.push(new vault.Mount(`children-${range.key}`, {
                namespace: range.value.pathFq,
                path: "secrets",
                type: "kv",
                options: {
                    version: "1",
                },
            }));
        }
    });
    const childrenSecret: vault.generic.Secret[] = [];
    childrenMount.apply(rangeBody => {
        for (const range of rangeBody.map((v, k) => ({key: k, value: v}))) {
            childrenSecret.push(new vault.generic.Secret(`children-${range.key}`, {
                namespace: range.value.namespace,
                path: `${range.value.path}/secret`,
                dataJson: JSON.stringify({
                    ns: range.key,
                }),
            }));
        }
    });
    
    import pulumi
    import json
    import pulumi_vault as vault
    
    config = pulumi.Config()
    child_namespaces = config.get_object("childNamespaces")
    if child_namespaces is None:
        child_namespaces = [
            "child_0",
            "child_1",
            "child_2",
        ]
    parent = vault.Namespace("parent", path="parent")
    children = []
    for range in [{"key": k, "value": v} for [k, v] in enumerate(child_namespaces)]:
        children.append(vault.Namespace(f"children-{range['key']}",
            namespace=parent.path,
            path=range["key"]))
    children_mount = []
    def create_children(range_body):
        for range in [{"key": k, "value": v} for [k, v] in enumerate(range_body)]:
            children_mount.append(vault.Mount(f"children-{range['key']}",
                namespace=range["value"].path_fq,
                path="secrets",
                type="kv",
                options={
                    "version": "1",
                }))
    
    children.apply(create_children)
    children_secret = []
    def create_children(range_body):
        for range in [{"key": k, "value": v} for [k, v] in enumerate(range_body)]:
            children_secret.append(vault.generic.Secret(f"children-{range['key']}",
                namespace=range["value"].namespace,
                path=f"{range['value'].path}/secret",
                data_json=json.dumps({
                    "ns": range["key"],
                })))
    
    children_mount.apply(create_children)
    
    package main
    
    import (
    	"encoding/json"
    	"fmt"
    
    	"github.com/pulumi/pulumi-vault/sdk/v7/go/vault"
    	"github.com/pulumi/pulumi-vault/sdk/v7/go/vault/generic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		childNamespaces := []string{
    			"child_0",
    			"child_1",
    			"child_2",
    		}
    		if param := cfg.GetObject("childNamespaces"); param != nil {
    			childNamespaces = param
    		}
    		parent, err := vault.NewNamespace(ctx, "parent", &vault.NamespaceArgs{
    			Path: pulumi.String("parent"),
    		})
    		if err != nil {
    			return err
    		}
    		var children []*vault.Namespace
    		for key0, _ := range childNamespaces {
    			__res, err := vault.NewNamespace(ctx, fmt.Sprintf("children-%v", key0), &vault.NamespaceArgs{
    				Namespace: parent.Path,
    				Path:      pulumi.String(pulumi.Float64(key0)),
    			})
    			if err != nil {
    				return err
    			}
    			children = append(children, __res)
    		}
    		var childrenMount []*vault.Mount
    		for key0, val0 := range children {
    			__res, err := vault.NewMount(ctx, fmt.Sprintf("children-%v", key0), &vault.MountArgs{
    				Namespace: pulumi.String(pulumi.String(val0)),
    				Path:      pulumi.String("secrets"),
    				Type:      pulumi.String("kv"),
    				Options: pulumi.StringMap{
    					"version": pulumi.String("1"),
    				},
    			})
    			if err != nil {
    				return err
    			}
    			childrenMount = append(childrenMount, __res)
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"ns": key0,
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		var childrenSecret []*generic.Secret
    		for key0, val0 := range childrenMount {
    			__res, err := generic.NewSecret(ctx, fmt.Sprintf("children-%v", key0), &generic.SecretArgs{
    				Namespace: pulumi.String(val0),
    				Path:      pulumi.Sprintf("%v/secret", val0),
    				DataJson:  pulumi.String(pulumi.String(json0)),
    			})
    			if err != nil {
    				return err
    			}
    			childrenSecret = append(childrenSecret, __res)
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var childNamespaces = config.GetObject<string[]>("childNamespaces") ?? new[]
        {
            "child_0",
            "child_1",
            "child_2",
        };
        var parent = new Vault.Namespace("parent", new()
        {
            Path = "parent",
        });
    
        var children = new List<Vault.Namespace>();
        foreach (var range in childNamespaces.Select((v, k) => new { Key = k, Value = v }))
        {
            children.Add(new Vault.Namespace($"children-{range.Key}", new()
            {
                TargetNamespace = parent.Path,
                Path = range.Key,
            }));
        }
        var childrenMount = new List<Vault.Mount>();
        foreach (var range in children.Select((v, k) => new { Key = k, Value = v }))
        {
            childrenMount.Add(new Vault.Mount($"children-{range.Key}", new()
            {
                Namespace = range.Value.PathFq,
                Path = "secrets",
                Type = "kv",
                Options = 
                {
                    { "version", "1" },
                },
            }));
        }
        var childrenSecret = new List<Vault.Generic.Secret>();
        foreach (var range in childrenMount.Select((v, k) => new { Key = k, Value = v }))
        {
            childrenSecret.Add(new Vault.Generic.Secret($"children-{range.Key}", new()
            {
                Namespace = range.Value.Namespace,
                Path = $"{range.Value.Path}/secret",
                DataJson = JsonSerializer.Serialize(new Dictionary<string, object?>
                {
                    ["ns"] = range.Key,
                }),
            }));
        }
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vault.Namespace;
    import com.pulumi.vault.NamespaceArgs;
    import com.pulumi.vault.Mount;
    import com.pulumi.vault.MountArgs;
    import com.pulumi.vault.generic.Secret;
    import com.pulumi.vault.generic.SecretArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import com.pulumi.codegen.internal.KeyedValue;
    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 config = ctx.config();
            final var childNamespaces = config.get("childNamespaces").orElse(List.of(        
                "child_0",
                "child_1",
                "child_2"));
            var parent = new Namespace("parent", NamespaceArgs.builder()
                .path("parent")
                .build());
    
            for (var range : KeyedValue.of(childNamespaces)) {
                new Namespace("children-" + range.key(), NamespaceArgs.builder()
                    .namespace(parent.path())
                    .path(range.key())
                    .build());
            }
    
            for (var range : KeyedValue.of(children)) {
                new Mount("childrenMount-" + range.key(), MountArgs.builder()
                    .namespace(range.value().pathFq())
                    .path("secrets")
                    .type("kv")
                    .options(Map.of("version", "1"))
                    .build());
            }
    
            for (var range : KeyedValue.of(childrenMount)) {
                new Secret("childrenSecret-" + range.key(), SecretArgs.builder()
                    .namespace(range.value().namespace())
                    .path(String.format("%s/secret", range.value().path()))
                    .dataJson(serializeJson(
                        jsonObject(
                            jsonProperty("ns", range.key())
                        )))
                    .build());
            }
    
        }
    }
    
    configuration:
      childNamespaces:
        type: list(string)
        default:
          - child_0
          - child_1
          - child_2
    resources:
      parent:
        type: vault:Namespace
        properties:
          path: parent
      children:
        type: vault:Namespace
        properties:
          namespace: ${parent.path}
          path: ${range.key}
        options: {}
      childrenMount:
        type: vault:Mount
        name: children
        properties:
          namespace: ${range.value.pathFq}
          path: secrets
          type: kv
          options:
            version: '1'
        options: {}
      childrenSecret:
        type: vault:generic:Secret
        name: children
        properties:
          namespace: ${range.value.namespace}
          path: ${range.value.path}/secret
          dataJson:
            fn::toJSON:
              ns: ${range.key}
        options: {}
    
    Example coming soon!
    

    Tutorials

    Refer to the Codify Management of Vault Enterprise Using Terraform tutorial for additional examples using Vault namespaces.

    Create Namespace Resource

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

    Constructor syntax

    new Namespace(name: string, args: NamespaceArgs, opts?: CustomResourceOptions);
    @overload
    def Namespace(resource_name: str,
                  args: NamespaceArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Namespace(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  path: Optional[str] = None,
                  custom_metadata: Optional[Mapping[str, str]] = None,
                  namespace: Optional[str] = None,
                  path_fq: Optional[str] = None)
    func NewNamespace(ctx *Context, name string, args NamespaceArgs, opts ...ResourceOption) (*Namespace, error)
    public Namespace(string name, NamespaceArgs args, CustomResourceOptions? opts = null)
    public Namespace(String name, NamespaceArgs args)
    public Namespace(String name, NamespaceArgs args, CustomResourceOptions options)
    
    type: vault:Namespace
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "vault_namespace" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args NamespaceArgs
    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 NamespaceArgs
    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 NamespaceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NamespaceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var namespaceResource = new Vault.Namespace("namespaceResource", new()
    {
        Path = "string",
        CustomMetadata = 
        {
            { "string", "string" },
        },
        TargetNamespace = "string",
        PathFq = "string",
    });
    
    example, err := vault.NewNamespace(ctx, "namespaceResource", &vault.NamespaceArgs{
    	Path: pulumi.String("string"),
    	CustomMetadata: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Namespace: pulumi.String("string"),
    	PathFq:    pulumi.String("string"),
    })
    
    resource "vault_namespace" "namespaceResource" {
      path = "string"
      custom_metadata = {
        "string" = "string"
      }
      namespace = "string"
      path_fq   = "string"
    }
    
    var namespaceResource = new Namespace("namespaceResource", NamespaceArgs.builder()
        .path("string")
        .customMetadata(Map.of("string", "string"))
        .namespace("string")
        .pathFq("string")
        .build());
    
    namespace_resource = vault.Namespace("namespaceResource",
        path="string",
        custom_metadata={
            "string": "string",
        },
        namespace="string",
        path_fq="string")
    
    const namespaceResource = new vault.Namespace("namespaceResource", {
        path: "string",
        customMetadata: {
            string: "string",
        },
        namespace: "string",
        pathFq: "string",
    });
    
    type: vault:Namespace
    properties:
        customMetadata:
            string: string
        namespace: string
        path: string
        pathFq: string
    

    Namespace Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Namespace resource accepts the following input properties:

    Path string
    The path of the namespace. Must not have a trailing /.
    CustomMetadata Dictionary<string, string>
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    PathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    TargetNamespace 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
    The path of the namespace. Must not have a trailing /.
    CustomMetadata map[string]string
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    PathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    path string
    The path of the namespace. Must not have a trailing /.
    custom_metadata map(string)
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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_fq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    path String
    The path of the namespace. Must not have a trailing /.
    customMetadata Map<String,String>
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    pathFq String
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    path string
    The path of the namespace. Must not have a trailing /.
    customMetadata {[key: string]: string}
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    pathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    path str
    The path of the namespace. Must not have a trailing /.
    custom_metadata Mapping[str, str]
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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_fq str
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    path String
    The path of the namespace. Must not have a trailing /.
    customMetadata Map<String>
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    pathFq String
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Namespace resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    NamespaceId string
    Vault server's internal ID of the namespace.
    Id string
    The provider-assigned unique ID for this managed resource.
    NamespaceId string
    Vault server's internal ID of the namespace.
    id string
    The provider-assigned unique ID for this managed resource.
    namespace_id string
    Vault server's internal ID of the namespace.
    id String
    The provider-assigned unique ID for this managed resource.
    namespaceId String
    Vault server's internal ID of the namespace.
    id string
    The provider-assigned unique ID for this managed resource.
    namespaceId string
    Vault server's internal ID of the namespace.
    id str
    The provider-assigned unique ID for this managed resource.
    namespace_id str
    Vault server's internal ID of the namespace.
    id String
    The provider-assigned unique ID for this managed resource.
    namespaceId String
    Vault server's internal ID of the namespace.

    Look up Existing Namespace Resource

    Get an existing Namespace 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?: NamespaceState, opts?: CustomResourceOptions): Namespace
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            custom_metadata: Optional[Mapping[str, str]] = None,
            namespace: Optional[str] = None,
            namespace_id: Optional[str] = None,
            path: Optional[str] = None,
            path_fq: Optional[str] = None) -> Namespace
    func GetNamespace(ctx *Context, name string, id IDInput, state *NamespaceState, opts ...ResourceOption) (*Namespace, error)
    public static Namespace Get(string name, Input<string> id, NamespaceState? state, CustomResourceOptions? opts = null)
    public static Namespace get(String name, Output<String> id, NamespaceState state, CustomResourceOptions options)
    resources:  _:    type: vault:Namespace    get:      id: ${id}
    import {
      to = vault_namespace.example
      id = "${id}"
    }
    
    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:
    CustomMetadata Dictionary<string, string>
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    NamespaceId string
    Vault server's internal ID of the namespace.
    Path string
    The path of the namespace. Must not have a trailing /.
    PathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    TargetNamespace 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.
    CustomMetadata map[string]string
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    NamespaceId string
    Vault server's internal ID of the namespace.
    Path string
    The path of the namespace. Must not have a trailing /.
    PathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    custom_metadata map(string)
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    namespace_id string
    Vault server's internal ID of the namespace.
    path string
    The path of the namespace. Must not have a trailing /.
    path_fq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    customMetadata Map<String,String>
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    namespaceId String
    Vault server's internal ID of the namespace.
    path String
    The path of the namespace. Must not have a trailing /.
    pathFq String
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    customMetadata {[key: string]: string}
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    namespaceId string
    Vault server's internal ID of the namespace.
    path string
    The path of the namespace. Must not have a trailing /.
    pathFq string
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    custom_metadata Mapping[str, str]
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    namespace_id str
    Vault server's internal ID of the namespace.
    path str
    The path of the namespace. Must not have a trailing /.
    path_fq str
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.
    customMetadata Map<String>
    Custom metadata describing this namespace. Value type is map[string]string. Requires Vault version 1.12+.
    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.
    namespaceId String
    Vault server's internal ID of the namespace.
    path String
    The path of the namespace. Must not have a trailing /.
    pathFq String
    The fully qualified path to the namespace. Useful when provisioning resources in a child namespace. The path is relative to the provider's namespace argument.

    Import

    Namespaces can be imported using its name as accessor id

    $ pulumi import vault:index/namespace:Namespace example <name>
    

    If the declared resource is imported and intends to support namespaces using a provider alias, then the name is relative to the namespace path.

    import * as pulumi from "@pulumi/pulumi";
    import * as vault from "@pulumi/vault";
    
    const example2 = new vault.Namespace("example2", {path: "example2"});
    
    import pulumi
    import pulumi_vault as vault
    
    example2 = vault.Namespace("example2", path="example2")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vault = Pulumi.Vault;
    
    return await Deployment.RunAsync(() => 
    {
        var example2 = new Vault.Namespace("example2", new()
        {
            Path = "example2",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vault/sdk/v7/go/vault"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vault.NewNamespace(ctx, "example2", &vault.NamespaceArgs{
    			Path: pulumi.String("example2"),
    		})
    		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.Namespace;
    import com.pulumi.vault.NamespaceArgs;
    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 example2 = new Namespace("example2", NamespaceArgs.builder()
                .path("example2")
                .build());
    
        }
    }
    
    resources:
      example2:
        type: vault:Namespace
        properties:
          path: example2
    
    $ pulumi import vault:index/namespace:Namespace example2 example2
    
    $ terraform state show vault_namespace.example2
    

    vault_namespace.example2: resource “vault.Namespace” “example2” { id = “example/example2/” namespaceId = path = “example2” pathFq = “example2” }

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Vault pulumi/pulumi-vault
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vault Terraform Provider.
    vault logo
    Viewing docs for HashiCorp Vault v7.8.0
    published on Tuesday, Mar 31, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.