Dynamic Host Volume Args
layout: "nomad" page_title: "Nomad: nomad.DynamicHostVolume" sidebar_current: "docs-nomad-resource-dynamic-host-volume" description: |- Manages the lifecycle of creating and deleting dynamic host volumes.
Creates and registers a dynamic host volume in Nomad. Note that Nomad supports two workflows for dynamic host volumes: create and register. Both resources result in the same data source with the same outputs.
Warning: Destroying this resource will result in data loss. Use the tf_docs_prevent_destroy directive to avoid accidental deletions.
Example Usage
Creating a dynamic host volume:
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const example = new nomad.DynamicHostVolume("example", {
name: "example",
namespace: "prod",
pluginId: "mkdir",
capacityMax: "12 GiB",
capacityMin: "1.0 GiB",
capabilities: [{
accessMode: "single-node-writer",
attachmentMode: "file-system",
}],
constraints: [{
attribute: `${attr.kernel.name}`,
value: "linux",
}],
parameters: {
some_key: "some_value",
},
});
import pulumi
import pulumi_nomad as nomad
example = nomad.DynamicHostVolume("example",
name="example",
namespace="prod",
plugin_id="mkdir",
capacity_max="12 GiB",
capacity_min="1.0 GiB",
capabilities=[{
"access_mode": "single-node-writer",
"attachment_mode": "file-system",
}],
constraints=[{
"attribute": "${attr.kernel.name}",
"value": "linux",
}],
parameters={
"some_key": "some_value",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Nomad = Pulumi.Nomad;
return await Deployment.RunAsync(() =>
{
var example = new Nomad.DynamicHostVolume("example", new()
{
Name = "example",
Namespace = "prod",
PluginId = "mkdir",
CapacityMax = "12 GiB",
CapacityMin = "1.0 GiB",
Capabilities = new[]
{
new Nomad.Inputs.DynamicHostVolumeCapabilityArgs
{
AccessMode = "single-node-writer",
AttachmentMode = "file-system",
},
},
Constraints = new[]
{
new Nomad.Inputs.DynamicHostVolumeConstraintArgs
{
Attribute = "${attr.kernel.name}",
Value = "linux",
},
},
Parameters =
{
{ "some_key", "some_value" },
},
});
});
package main
import (
"fmt"
"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.NewDynamicHostVolume(ctx, "example", &nomad.DynamicHostVolumeArgs{
Name: pulumi.String("example"),
Namespace: pulumi.String("prod"),
PluginId: pulumi.String("mkdir"),
CapacityMax: pulumi.String("12 GiB"),
CapacityMin: pulumi.String("1.0 GiB"),
Capabilities: nomad.DynamicHostVolumeCapabilityArray{
&nomad.DynamicHostVolumeCapabilityArgs{
AccessMode: pulumi.String("single-node-writer"),
AttachmentMode: pulumi.String("file-system"),
},
},
Constraints: nomad.DynamicHostVolumeConstraintArray{
&nomad.DynamicHostVolumeConstraintArgs{
Attribute: pulumi.Sprintf("${attr.kernel.name}"),
Value: pulumi.String("linux"),
},
},
Parameters: pulumi.StringMap{
"some_key": pulumi.String("some_value"),
},
})
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.DynamicHostVolume;
import com.pulumi.nomad.DynamicHostVolumeArgs;
import com.pulumi.nomad.inputs.DynamicHostVolumeCapabilityArgs;
import com.pulumi.nomad.inputs.DynamicHostVolumeConstraintArgs;
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 example = new DynamicHostVolume("example", DynamicHostVolumeArgs.builder()
.name("example")
.namespace("prod")
.pluginId("mkdir")
.capacityMax("12 GiB")
.capacityMin("1.0 GiB")
.capabilities(DynamicHostVolumeCapabilityArgs.builder()
.accessMode("single-node-writer")
.attachmentMode("file-system")
.build())
.constraints(DynamicHostVolumeConstraintArgs.builder()
.attribute("${attr.kernel.name}")
.value("linux")
.build())
.parameters(Map.of("some_key", "some_value"))
.build());
}
}
resources:
example:
type: nomad:DynamicHostVolume
properties:
name: example
namespace: prod
pluginId: mkdir
capacityMax: 12 GiB
capacityMin: 1.0 GiB
capabilities:
- accessMode: single-node-writer
attachmentMode: file-system
constraints:
- attribute: $${attr.kernel.name}
value: linux
parameters:
some_key: some_value
Constructors
Properties
(block: <optional>)
- Option for validating the capability of a volume. Each capability block has the following attributes:
(string: <optional>)
- Option for requesting a maximum capacity, in bytes. The capacity of a volume may be the physical size of a disk, or a quota, depending on the plugin. The specific size of the resulting volume is somewhere between capacity_min
and capacity_max
; the exact behavior is up to the plugin. If you want to specify an exact size, set capacity_min
and capacity_max
to the same value. Accepts human-friendly suffixes such as "100GiB"
. Plugins that cannot restrict the size of volumes may ignore this field.
(string: <optional>)
- Option for requesting a minimum capacity, in bytes. The capacity of a volume may be the physical size of a disk, or a quota, depending on the plugin. The specific size of the resulting volume is somewhere between capacity_min
and capacity_max
; the exact behavior is up to the plugin. If you want to specify an exact size, set capacity_min
and capacity_max
to the same value. Accepts human-friendly suffixes such as "100GiB"
. Plugins that cannot restrict the size of volumes may ignore this field.
(block: <optional>)
- A restriction on the eligible nodes where a volume can be created, similar to the `constraint` block on a Nomad job specification.. You can provide multiple constraint
blocks to add more constraints. Each constraint block has the following attributes.
(string: <required>)
- The name of the volume, which is used as the volume_source field in job specifications that claim this volume. Host volume names must be unique per node. Names are visible to any user with node:read
ACL, even across namespaces, so they should not be treated as sensitive values.
(map<string|string>: <optional>)
- A key-value map of strings passed directly to the plugin to configure the volume. The details of these parameters are specific to the plugin.