nomad.Namespace
Provisions a namespace within a Nomad cluster.
Nomad auto-generates a default namespace called default
. This namespace
cannot be removed, so destroying a nomad.Namespace
resource where
name = "default"
will cause the namespace to be reset to its default
configuration.
Example Usage
Registering a namespace
using System.Collections.Generic;
using Pulumi;
using Nomad = Pulumi.Nomad;
return await Deployment.RunAsync(() =>
{
var dev = new Nomad.Namespace("dev", new()
{
Description = "Shared development environment.",
Meta =
{
{ "foo", "bar" },
{ "owner", "John Doe" },
},
Quota = "dev",
});
});
package main
import (
"github.com/pulumi/pulumi-nomad/sdk/go/nomad"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := nomad.NewNamespace(ctx, "dev", &nomad.NamespaceArgs{
Description: pulumi.String("Shared development environment."),
Meta: pulumi.StringMap{
"foo": pulumi.String("bar"),
"owner": pulumi.String("John Doe"),
},
Quota: pulumi.String("dev"),
})
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.nomad.Namespace;
import com.pulumi.nomad.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 dev = new Namespace("dev", NamespaceArgs.builder()
.description("Shared development environment.")
.meta(Map.ofEntries(
Map.entry("foo", "bar"),
Map.entry("owner", "John Doe")
))
.quota("dev")
.build());
}
}
import pulumi
import pulumi_nomad as nomad
dev = nomad.Namespace("dev",
description="Shared development environment.",
meta={
"foo": "bar",
"owner": "John Doe",
},
quota="dev")
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const dev = new nomad.Namespace("dev", {
description: "Shared development environment.",
meta: {
foo: "bar",
owner: "John Doe",
},
quota: "dev",
});
resources:
dev:
type: nomad:Namespace
properties:
description: Shared development environment.
meta:
foo: bar
owner: John Doe
quota: dev
Registering a namespace with a quota
using System.Collections.Generic;
using Pulumi;
using Nomad = Pulumi.Nomad;
return await Deployment.RunAsync(() =>
{
var webTeam = new Nomad.QuoteSpecification("webTeam", new()
{
Description = "web team quota",
Limits = new[]
{
new Nomad.Inputs.QuoteSpecificationLimitArgs
{
Region = "global",
RegionLimit = new Nomad.Inputs.QuoteSpecificationLimitRegionLimitArgs
{
Cpu = 1000,
MemoryMb = 256,
},
},
},
});
var web = new Nomad.Namespace("web", new()
{
Description = "Web team production environment.",
Quota = webTeam.Name,
});
});
package main
import (
"github.com/pulumi/pulumi-nomad/sdk/go/nomad"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
webTeam, err := nomad.NewQuoteSpecification(ctx, "webTeam", &nomad.QuoteSpecificationArgs{
Description: pulumi.String("web team quota"),
Limits: nomad.QuoteSpecificationLimitArray{
&nomad.QuoteSpecificationLimitArgs{
Region: pulumi.String("global"),
RegionLimit: &nomad.QuoteSpecificationLimitRegionLimitArgs{
Cpu: pulumi.Int(1000),
MemoryMb: pulumi.Int(256),
},
},
},
})
if err != nil {
return err
}
_, err = nomad.NewNamespace(ctx, "web", &nomad.NamespaceArgs{
Description: pulumi.String("Web team production environment."),
Quota: webTeam.Name,
})
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.nomad.QuoteSpecification;
import com.pulumi.nomad.QuoteSpecificationArgs;
import com.pulumi.nomad.inputs.QuoteSpecificationLimitArgs;
import com.pulumi.nomad.inputs.QuoteSpecificationLimitRegionLimitArgs;
import com.pulumi.nomad.Namespace;
import com.pulumi.nomad.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 webTeam = new QuoteSpecification("webTeam", QuoteSpecificationArgs.builder()
.description("web team quota")
.limits(QuoteSpecificationLimitArgs.builder()
.region("global")
.regionLimit(QuoteSpecificationLimitRegionLimitArgs.builder()
.cpu(1000)
.memoryMb(256)
.build())
.build())
.build());
var web = new Namespace("web", NamespaceArgs.builder()
.description("Web team production environment.")
.quota(webTeam.name())
.build());
}
}
import pulumi
import pulumi_nomad as nomad
web_team = nomad.QuoteSpecification("webTeam",
description="web team quota",
limits=[nomad.QuoteSpecificationLimitArgs(
region="global",
region_limit=nomad.QuoteSpecificationLimitRegionLimitArgs(
cpu=1000,
memory_mb=256,
),
)])
web = nomad.Namespace("web",
description="Web team production environment.",
quota=web_team.name)
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const webTeam = new nomad.QuoteSpecification("webTeam", {
description: "web team quota",
limits: [{
region: "global",
regionLimit: {
cpu: 1000,
memoryMb: 256,
},
}],
});
const web = new nomad.Namespace("web", {
description: "Web team production environment.",
quota: webTeam.name,
});
resources:
webTeam:
type: nomad:QuoteSpecification
properties:
description: web team quota
limits:
- region: global
regionLimit:
cpu: 1000
memoryMb: 256
web:
type: nomad:Namespace
properties:
description: Web team production environment.
quota: ${webTeam.name}
Create Namespace Resource
new Namespace(name: string, args?: NamespaceArgs, opts?: CustomResourceOptions);
@overload
def Namespace(resource_name: str,
opts: Optional[ResourceOptions] = None,
capabilities: Optional[NamespaceCapabilitiesArgs] = None,
description: Optional[str] = None,
meta: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
quota: Optional[str] = None)
@overload
def Namespace(resource_name: str,
args: Optional[NamespaceArgs] = None,
opts: Optional[ResourceOptions] = 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: nomad:Namespace
properties: # The arguments to resource properties.
options: # 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.
- 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.
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
The Namespace resource accepts the following input properties:
- Capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- Description string
(string: "")
- A description of the namespace.- Meta Dictionary<string, string>
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- Name string
(string: <required>)
- A unique name for the namespace.- Quota string
(string: "")
- A resource quota to attach to the namespace.
- Capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- Description string
(string: "")
- A description of the namespace.- Meta map[string]string
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- Name string
(string: <required>)
- A unique name for the namespace.- Quota string
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description String
(string: "")
- A description of the namespace.- meta Map<String,String>
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name String
(string: <required>)
- A unique name for the namespace.- quota String
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description string
(string: "")
- A description of the namespace.- meta {[key: string]: string}
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name string
(string: <required>)
- A unique name for the namespace.- quota string
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description str
(string: "")
- A description of the namespace.- meta Mapping[str, str]
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name str
(string: <required>)
- A unique name for the namespace.- quota str
(string: "")
- A resource quota to attach to the namespace.
- capabilities Property Map
(block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description String
(string: "")
- A description of the namespace.- meta Map<String>
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name String
(string: <required>)
- A unique name for the namespace.- quota String
(string: "")
- A resource quota to attach to the 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,
capabilities: Optional[NamespaceCapabilitiesArgs] = None,
description: Optional[str] = None,
meta: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
quota: 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)
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.
- Capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- Description string
(string: "")
- A description of the namespace.- Meta Dictionary<string, string>
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- Name string
(string: <required>)
- A unique name for the namespace.- Quota string
(string: "")
- A resource quota to attach to the namespace.
- Capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- Description string
(string: "")
- A description of the namespace.- Meta map[string]string
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- Name string
(string: <required>)
- A unique name for the namespace.- Quota string
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description String
(string: "")
- A description of the namespace.- meta Map<String,String>
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name String
(string: <required>)
- A unique name for the namespace.- quota String
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description string
(string: "")
- A description of the namespace.- meta {[key: string]: string}
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name string
(string: <required>)
- A unique name for the namespace.- quota string
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities Args (block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description str
(string: "")
- A description of the namespace.- meta Mapping[str, str]
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name str
(string: <required>)
- A unique name for the namespace.- quota str
(string: "")
- A resource quota to attach to the namespace.
- capabilities Property Map
(block: <optional>)
- A block of capabilities for the namespace. Can't be repeated. See below for the structure of this block.- description String
(string: "")
- A description of the namespace.- meta Map<String>
(map[string]string: <optional>)
- Specifies arbitrary KV metadata to associate with the namespace.- name String
(string: <required>)
- A unique name for the namespace.- quota String
(string: "")
- A resource quota to attach to the namespace.
Supporting Types
NamespaceCapabilities
- Disabled
Task List<string>Drivers ([]string: <optional>)
- Task drivers disabled for the namespace.- Enabled
Task List<string>Drivers ([]string: <optional>)
- Task drivers enabled for the namespace.
- Disabled
Task []stringDrivers ([]string: <optional>)
- Task drivers disabled for the namespace.- Enabled
Task []stringDrivers ([]string: <optional>)
- Task drivers enabled for the namespace.
- disabled
Task List<String>Drivers ([]string: <optional>)
- Task drivers disabled for the namespace.- enabled
Task List<String>Drivers ([]string: <optional>)
- Task drivers enabled for the namespace.
- disabled
Task string[]Drivers ([]string: <optional>)
- Task drivers disabled for the namespace.- enabled
Task string[]Drivers ([]string: <optional>)
- Task drivers enabled for the namespace.
- disabled_
task_ Sequence[str]drivers ([]string: <optional>)
- Task drivers disabled for the namespace.- enabled_
task_ Sequence[str]drivers ([]string: <optional>)
- Task drivers enabled for the namespace.
- disabled
Task List<String>Drivers ([]string: <optional>)
- Task drivers disabled for the namespace.- enabled
Task List<String>Drivers ([]string: <optional>)
- Task drivers enabled for the namespace.
Package Details
- Repository
- HashiCorp Nomad pulumi/pulumi-nomad
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
nomad
Terraform Provider.