nomad.Namespace
Explore with Pulumi AI
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:
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const dev = new nomad.Namespace("dev", {
name: "dev",
description: "Shared development environment.",
quota: "dev",
meta: {
owner: "John Doe",
foo: "bar",
},
});
import pulumi
import pulumi_nomad as nomad
dev = nomad.Namespace("dev",
name="dev",
description="Shared development environment.",
quota="dev",
meta={
"owner": "John Doe",
"foo": "bar",
})
package main
import (
"github.com/pulumi/pulumi-nomad/sdk/v2/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{
Name: pulumi.String("dev"),
Description: pulumi.String("Shared development environment."),
Quota: pulumi.String("dev"),
Meta: pulumi.StringMap{
"owner": pulumi.String("John Doe"),
"foo": pulumi.String("bar"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Nomad = Pulumi.Nomad;
return await Deployment.RunAsync(() =>
{
var dev = new Nomad.Namespace("dev", new()
{
Name = "dev",
Description = "Shared development environment.",
Quota = "dev",
Meta =
{
{ "owner", "John Doe" },
{ "foo", "bar" },
},
});
});
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()
.name("dev")
.description("Shared development environment.")
.quota("dev")
.meta(Map.ofEntries(
Map.entry("owner", "John Doe"),
Map.entry("foo", "bar")
))
.build());
}
}
resources:
dev:
type: nomad:Namespace
properties:
name: dev
description: Shared development environment.
quota: dev
meta:
owner: John Doe
foo: bar
Registering a namespace with a quota:
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const webTeam = new nomad.QuoteSpecification("web_team", {
name: "web-team",
description: "web team quota",
limits: [{
region: "global",
regionLimit: {
cpu: 1000,
memoryMb: 256,
},
}],
});
const web = new nomad.Namespace("web", {
name: "web",
description: "Web team production environment.",
quota: webTeam.name,
});
import pulumi
import pulumi_nomad as nomad
web_team = nomad.QuoteSpecification("web_team",
name="web-team",
description="web team quota",
limits=[{
"region": "global",
"region_limit": {
"cpu": 1000,
"memory_mb": 256,
},
}])
web = nomad.Namespace("web",
name="web",
description="Web team production environment.",
quota=web_team.name)
package main
import (
"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
webTeam, err := nomad.NewQuoteSpecification(ctx, "web_team", &nomad.QuoteSpecificationArgs{
Name: pulumi.String("web-team"),
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{
Name: pulumi.String("web"),
Description: pulumi.String("Web team production environment."),
Quota: webTeam.Name,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Nomad = Pulumi.Nomad;
return await Deployment.RunAsync(() =>
{
var webTeam = new Nomad.QuoteSpecification("web_team", new()
{
Name = "web-team",
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()
{
Name = "web",
Description = "Web team production environment.",
Quota = webTeam.Name,
});
});
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()
.name("web-team")
.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()
.name("web")
.description("Web team production environment.")
.quota(webTeam.name())
.build());
}
}
resources:
webTeam:
type: nomad:QuoteSpecification
name: web_team
properties:
name: web-team
description: web team quota
limits:
- region: global
regionLimit:
cpu: 1000
memoryMb: 256
web:
type: nomad:Namespace
properties:
name: web
description: Web team production environment.
quota: ${webTeam.name}
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,
capabilities: Optional[NamespaceCapabilitiesArgs] = None,
description: Optional[str] = None,
meta: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
node_pool_config: Optional[NamespaceNodePoolConfigArgs] = None,
quota: Optional[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: nomad: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 Nomad.Namespace("namespaceResource", new()
{
Capabilities = new Nomad.Inputs.NamespaceCapabilitiesArgs
{
DisabledTaskDrivers = new[]
{
"string",
},
EnabledTaskDrivers = new[]
{
"string",
},
},
Description = "string",
Meta =
{
{ "string", "string" },
},
Name = "string",
NodePoolConfig = new Nomad.Inputs.NamespaceNodePoolConfigArgs
{
Alloweds = new[]
{
"string",
},
Default = "string",
Denieds = new[]
{
"string",
},
},
Quota = "string",
});
example, err := nomad.NewNamespace(ctx, "namespaceResource", &nomad.NamespaceArgs{
Capabilities: &nomad.NamespaceCapabilitiesArgs{
DisabledTaskDrivers: pulumi.StringArray{
pulumi.String("string"),
},
EnabledTaskDrivers: pulumi.StringArray{
pulumi.String("string"),
},
},
Description: pulumi.String("string"),
Meta: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
NodePoolConfig: &nomad.NamespaceNodePoolConfigArgs{
Alloweds: pulumi.StringArray{
pulumi.String("string"),
},
Default: pulumi.String("string"),
Denieds: pulumi.StringArray{
pulumi.String("string"),
},
},
Quota: pulumi.String("string"),
})
var namespaceResource = new Namespace("namespaceResource", NamespaceArgs.builder()
.capabilities(NamespaceCapabilitiesArgs.builder()
.disabledTaskDrivers("string")
.enabledTaskDrivers("string")
.build())
.description("string")
.meta(Map.of("string", "string"))
.name("string")
.nodePoolConfig(NamespaceNodePoolConfigArgs.builder()
.alloweds("string")
.default_("string")
.denieds("string")
.build())
.quota("string")
.build());
namespace_resource = nomad.Namespace("namespaceResource",
capabilities={
"disabled_task_drivers": ["string"],
"enabled_task_drivers": ["string"],
},
description="string",
meta={
"string": "string",
},
name="string",
node_pool_config={
"alloweds": ["string"],
"default": "string",
"denieds": ["string"],
},
quota="string")
const namespaceResource = new nomad.Namespace("namespaceResource", {
capabilities: {
disabledTaskDrivers: ["string"],
enabledTaskDrivers: ["string"],
},
description: "string",
meta: {
string: "string",
},
name: "string",
nodePoolConfig: {
alloweds: ["string"],
"default": "string",
denieds: ["string"],
},
quota: "string",
});
type: nomad:Namespace
properties:
capabilities:
disabledTaskDrivers:
- string
enabledTaskDrivers:
- string
description: string
meta:
string: string
name: string
nodePoolConfig:
alloweds:
- string
default: string
denieds:
- string
quota: 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:
- Capabilities
Namespace
Capabilities (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.- Node
Pool NamespaceConfig Node Pool Config (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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.- Node
Pool NamespaceConfig Node Pool Config Args (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- Quota string
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities (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.- node
Pool NamespaceConfig Node Pool Config (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- quota String
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities (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.- node
Pool NamespaceConfig Node Pool Config (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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.- node_
pool_ Namespaceconfig Node Pool Config Args (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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.- node
Pool Property MapConfig (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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,
node_pool_config: Optional[NamespaceNodePoolConfigArgs] = 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 (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.- Node
Pool NamespaceConfig Node Pool Config (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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.- Node
Pool NamespaceConfig Node Pool Config Args (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- Quota string
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities (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.- node
Pool NamespaceConfig Node Pool Config (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- quota String
(string: "")
- A resource quota to attach to the namespace.
- capabilities
Namespace
Capabilities (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.- node
Pool NamespaceConfig Node Pool Config (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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.- node_
pool_ Namespaceconfig Node Pool Config Args (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- 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.- node
Pool Property MapConfig (block: <optional>)
- A block with node pool configuration for the namespace (Nomad Enterprise only).- quota String
(string: "")
- A resource quota to attach to the namespace.
Supporting Types
NamespaceCapabilities, NamespaceCapabilitiesArgs
- 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.
NamespaceNodePoolConfig, NamespaceNodePoolConfigArgs
- Alloweds List<string>
([]string: <optional>)
- The list of node pools that are allowed to be used in this namespace.- Default string
(string: <optional>)
- The default node pool for jobs that don't define one.- Denieds List<string>
([]string: <optional>)
- The list of node pools that are not allowed to be used in this namespace.
- Alloweds []string
([]string: <optional>)
- The list of node pools that are allowed to be used in this namespace.- Default string
(string: <optional>)
- The default node pool for jobs that don't define one.- Denieds []string
([]string: <optional>)
- The list of node pools that are not allowed to be used in this namespace.
- alloweds List<String>
([]string: <optional>)
- The list of node pools that are allowed to be used in this namespace.- default_ String
(string: <optional>)
- The default node pool for jobs that don't define one.- denieds List<String>
([]string: <optional>)
- The list of node pools that are not allowed to be used in this namespace.
- alloweds string[]
([]string: <optional>)
- The list of node pools that are allowed to be used in this namespace.- default string
(string: <optional>)
- The default node pool for jobs that don't define one.- denieds string[]
([]string: <optional>)
- The list of node pools that are not allowed to be used in this namespace.
- alloweds Sequence[str]
([]string: <optional>)
- The list of node pools that are allowed to be used in this namespace.- default str
(string: <optional>)
- The default node pool for jobs that don't define one.- denieds Sequence[str]
([]string: <optional>)
- The list of node pools that are not allowed to be used in this namespace.
- alloweds List<String>
([]string: <optional>)
- The list of node pools that are allowed to be used in this namespace.- default String
(string: <optional>)
- The default node pool for jobs that don't define one.- denieds List<String>
([]string: <optional>)
- The list of node pools that are not allowed to be used in this namespace.
Package Details
- Repository
- HashiCorp Nomad pulumi/pulumi-nomad
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
nomad
Terraform Provider.