consul.Namespace
Explore with Pulumi AI
NOTE: This feature requires Consul Enterprise.
The consul.Namespace
resource provides isolated Consul Enterprise Namespaces.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
const production = new consul.Namespace("production", {
name: "production",
description: "Production namespace",
meta: {
foo: "bar",
},
});
import pulumi
import pulumi_consul as consul
production = consul.Namespace("production",
name="production",
description="Production namespace",
meta={
"foo": "bar",
})
package main
import (
"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := consul.NewNamespace(ctx, "production", &consul.NamespaceArgs{
Name: pulumi.String("production"),
Description: pulumi.String("Production namespace"),
Meta: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Consul = Pulumi.Consul;
return await Deployment.RunAsync(() =>
{
var production = new Consul.Namespace("production", new()
{
Name = "production",
Description = "Production namespace",
Meta =
{
{ "foo", "bar" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.Namespace;
import com.pulumi.consul.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 production = new Namespace("production", NamespaceArgs.builder()
.name("production")
.description("Production namespace")
.meta(Map.of("foo", "bar"))
.build());
}
}
resources:
production:
type: consul:Namespace
properties:
name: production
description: Production namespace
meta:
foo: bar
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: Optional[NamespaceArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Namespace(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
meta: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
partition: Optional[str] = None,
policy_defaults: Optional[Sequence[str]] = None,
role_defaults: Optional[Sequence[str]] = None)
func NewNamespace(ctx *Context, name string, args *NamespaceArgs, opts ...ResourceOption) (*Namespace, error)
public Namespace(string name, NamespaceArgs? args = null, CustomResourceOptions? opts = null)
public Namespace(String name, NamespaceArgs args)
public Namespace(String name, NamespaceArgs args, CustomResourceOptions options)
type: consul:Namespace
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 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 Consul.Namespace("namespaceResource", new()
{
Description = "string",
Meta =
{
{ "string", "string" },
},
Name = "string",
Partition = "string",
PolicyDefaults = new[]
{
"string",
},
RoleDefaults = new[]
{
"string",
},
});
example, err := consul.NewNamespace(ctx, "namespaceResource", &consul.NamespaceArgs{
Description: pulumi.String("string"),
Meta: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
Partition: pulumi.String("string"),
PolicyDefaults: pulumi.StringArray{
pulumi.String("string"),
},
RoleDefaults: pulumi.StringArray{
pulumi.String("string"),
},
})
var namespaceResource = new Namespace("namespaceResource", NamespaceArgs.builder()
.description("string")
.meta(Map.of("string", "string"))
.name("string")
.partition("string")
.policyDefaults("string")
.roleDefaults("string")
.build());
namespace_resource = consul.Namespace("namespaceResource",
description="string",
meta={
"string": "string",
},
name="string",
partition="string",
policy_defaults=["string"],
role_defaults=["string"])
const namespaceResource = new consul.Namespace("namespaceResource", {
description: "string",
meta: {
string: "string",
},
name: "string",
partition: "string",
policyDefaults: ["string"],
roleDefaults: ["string"],
});
type: consul:Namespace
properties:
description: string
meta:
string: string
name: string
partition: string
policyDefaults:
- string
roleDefaults:
- 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:
- Description string
- Free form namespace description.
- Meta Dictionary<string, string>
- Specifies arbitrary KV metadata to associate with the namespace.
- Name string
- The namespace name.
- Partition string
- The partition to create the namespace within.
- Policy
Defaults List<string> - The list of default policies that should be applied to all tokens created in this namespace.
- Role
Defaults List<string> - The list of default roles that should be applied to all tokens created in this namespace.
- Description string
- Free form namespace description.
- Meta map[string]string
- Specifies arbitrary KV metadata to associate with the namespace.
- Name string
- The namespace name.
- Partition string
- The partition to create the namespace within.
- Policy
Defaults []string - The list of default policies that should be applied to all tokens created in this namespace.
- Role
Defaults []string - The list of default roles that should be applied to all tokens created in this namespace.
- description String
- Free form namespace description.
- meta Map<String,String>
- Specifies arbitrary KV metadata to associate with the namespace.
- name String
- The namespace name.
- partition String
- The partition to create the namespace within.
- policy
Defaults List<String> - The list of default policies that should be applied to all tokens created in this namespace.
- role
Defaults List<String> - The list of default roles that should be applied to all tokens created in this namespace.
- description string
- Free form namespace description.
- meta {[key: string]: string}
- Specifies arbitrary KV metadata to associate with the namespace.
- name string
- The namespace name.
- partition string
- The partition to create the namespace within.
- policy
Defaults string[] - The list of default policies that should be applied to all tokens created in this namespace.
- role
Defaults string[] - The list of default roles that should be applied to all tokens created in this namespace.
- description str
- Free form namespace description.
- meta Mapping[str, str]
- Specifies arbitrary KV metadata to associate with the namespace.
- name str
- The namespace name.
- partition str
- The partition to create the namespace within.
- policy_
defaults Sequence[str] - The list of default policies that should be applied to all tokens created in this namespace.
- role_
defaults Sequence[str] - The list of default roles that should be applied to all tokens created in this namespace.
- description String
- Free form namespace description.
- meta Map<String>
- Specifies arbitrary KV metadata to associate with the namespace.
- name String
- The namespace name.
- partition String
- The partition to create the namespace within.
- policy
Defaults List<String> - The list of default policies that should be applied to all tokens created in this namespace.
- role
Defaults List<String> - The list of default roles that should be applied to all tokens created in this namespace.
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.
- 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 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,
description: Optional[str] = None,
meta: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
partition: Optional[str] = None,
policy_defaults: Optional[Sequence[str]] = None,
role_defaults: Optional[Sequence[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)
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.
- Description string
- Free form namespace description.
- Meta Dictionary<string, string>
- Specifies arbitrary KV metadata to associate with the namespace.
- Name string
- The namespace name.
- Partition string
- The partition to create the namespace within.
- Policy
Defaults List<string> - The list of default policies that should be applied to all tokens created in this namespace.
- Role
Defaults List<string> - The list of default roles that should be applied to all tokens created in this namespace.
- Description string
- Free form namespace description.
- Meta map[string]string
- Specifies arbitrary KV metadata to associate with the namespace.
- Name string
- The namespace name.
- Partition string
- The partition to create the namespace within.
- Policy
Defaults []string - The list of default policies that should be applied to all tokens created in this namespace.
- Role
Defaults []string - The list of default roles that should be applied to all tokens created in this namespace.
- description String
- Free form namespace description.
- meta Map<String,String>
- Specifies arbitrary KV metadata to associate with the namespace.
- name String
- The namespace name.
- partition String
- The partition to create the namespace within.
- policy
Defaults List<String> - The list of default policies that should be applied to all tokens created in this namespace.
- role
Defaults List<String> - The list of default roles that should be applied to all tokens created in this namespace.
- description string
- Free form namespace description.
- meta {[key: string]: string}
- Specifies arbitrary KV metadata to associate with the namespace.
- name string
- The namespace name.
- partition string
- The partition to create the namespace within.
- policy
Defaults string[] - The list of default policies that should be applied to all tokens created in this namespace.
- role
Defaults string[] - The list of default roles that should be applied to all tokens created in this namespace.
- description str
- Free form namespace description.
- meta Mapping[str, str]
- Specifies arbitrary KV metadata to associate with the namespace.
- name str
- The namespace name.
- partition str
- The partition to create the namespace within.
- policy_
defaults Sequence[str] - The list of default policies that should be applied to all tokens created in this namespace.
- role_
defaults Sequence[str] - The list of default roles that should be applied to all tokens created in this namespace.
- description String
- Free form namespace description.
- meta Map<String>
- Specifies arbitrary KV metadata to associate with the namespace.
- name String
- The namespace name.
- partition String
- The partition to create the namespace within.
- policy
Defaults List<String> - The list of default policies that should be applied to all tokens created in this namespace.
- role
Defaults List<String> - The list of default roles that should be applied to all tokens created in this namespace.
Import
consul_namespace
can be imported. This is useful to manage attributes of the
default namespace that is created automatically:
$ pulumi import consul:index/namespace:Namespace default default
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consul
Terraform Provider.