nomad.Variable
Explore with Pulumi AI
Example Usage
Creating a variable in the default namespace:
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const example = new nomad.Variable("example", {
path: "some/path/of/your/choosing",
items: {
example_key: "example_value",
},
});
import pulumi
import pulumi_nomad as nomad
example = nomad.Variable("example",
path="some/path/of/your/choosing",
items={
"example_key": "example_value",
})
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.NewVariable(ctx, "example", &nomad.VariableArgs{
Path: pulumi.String("some/path/of/your/choosing"),
Items: pulumi.StringMap{
"example_key": pulumi.String("example_value"),
},
})
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 example = new Nomad.Variable("example", new()
{
Path = "some/path/of/your/choosing",
Items =
{
{ "example_key", "example_value" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.nomad.Variable;
import com.pulumi.nomad.VariableArgs;
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 Variable("example", VariableArgs.builder()
.path("some/path/of/your/choosing")
.items(Map.of("example_key", "example_value"))
.build());
}
}
resources:
example:
type: nomad:Variable
properties:
path: some/path/of/your/choosing
items:
example_key: example_value
Creating a variable in a custom namespace:
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
const example = new nomad.Namespace("example", {
name: "example",
description: "Example namespace.",
});
const exampleVariable = new nomad.Variable("example", {
path: "some/path/of/your/choosing",
namespace: example.name,
items: {
example_key: "example_value",
},
});
import pulumi
import pulumi_nomad as nomad
example = nomad.Namespace("example",
name="example",
description="Example namespace.")
example_variable = nomad.Variable("example",
path="some/path/of/your/choosing",
namespace=example.name,
items={
"example_key": "example_value",
})
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 {
example, err := nomad.NewNamespace(ctx, "example", &nomad.NamespaceArgs{
Name: pulumi.String("example"),
Description: pulumi.String("Example namespace."),
})
if err != nil {
return err
}
_, err = nomad.NewVariable(ctx, "example", &nomad.VariableArgs{
Path: pulumi.String("some/path/of/your/choosing"),
Namespace: example.Name,
Items: pulumi.StringMap{
"example_key": pulumi.String("example_value"),
},
})
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 example = new Nomad.Namespace("example", new()
{
Name = "example",
Description = "Example namespace.",
});
var exampleVariable = new Nomad.Variable("example", new()
{
Path = "some/path/of/your/choosing",
Namespace = example.Name,
Items =
{
{ "example_key", "example_value" },
},
});
});
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 com.pulumi.nomad.Variable;
import com.pulumi.nomad.VariableArgs;
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 Namespace("example", NamespaceArgs.builder()
.name("example")
.description("Example namespace.")
.build());
var exampleVariable = new Variable("exampleVariable", VariableArgs.builder()
.path("some/path/of/your/choosing")
.namespace(example.name())
.items(Map.of("example_key", "example_value"))
.build());
}
}
resources:
example:
type: nomad:Namespace
properties:
name: example
description: Example namespace.
exampleVariable:
type: nomad:Variable
name: example
properties:
path: some/path/of/your/choosing
namespace: ${example.name}
items:
example_key: example_value
Create Variable Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Variable(name: string, args: VariableArgs, opts?: CustomResourceOptions);
@overload
def Variable(resource_name: str,
args: VariableArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Variable(resource_name: str,
opts: Optional[ResourceOptions] = None,
items: Optional[Mapping[str, str]] = None,
path: Optional[str] = None,
namespace: Optional[str] = None)
func NewVariable(ctx *Context, name string, args VariableArgs, opts ...ResourceOption) (*Variable, error)
public Variable(string name, VariableArgs args, CustomResourceOptions? opts = null)
public Variable(String name, VariableArgs args)
public Variable(String name, VariableArgs args, CustomResourceOptions options)
type: nomad:Variable
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 VariableArgs
- 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 VariableArgs
- 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 VariableArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VariableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VariableArgs
- 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 variableResource = new Nomad.Variable("variableResource", new()
{
Items =
{
{ "string", "string" },
},
Path = "string",
Namespace = "string",
});
example, err := nomad.NewVariable(ctx, "variableResource", &nomad.VariableArgs{
Items: pulumi.StringMap{
"string": pulumi.String("string"),
},
Path: pulumi.String("string"),
Namespace: pulumi.String("string"),
})
var variableResource = new Variable("variableResource", VariableArgs.builder()
.items(Map.of("string", "string"))
.path("string")
.namespace("string")
.build());
variable_resource = nomad.Variable("variableResource",
items={
"string": "string",
},
path="string",
namespace="string")
const variableResource = new nomad.Variable("variableResource", {
items: {
string: "string",
},
path: "string",
namespace: "string",
});
type: nomad:Variable
properties:
items:
string: string
namespace: string
path: string
Variable 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 Variable resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the Variable 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 Variable Resource
Get an existing Variable 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?: VariableState, opts?: CustomResourceOptions): Variable
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
items: Optional[Mapping[str, str]] = None,
namespace: Optional[str] = None,
path: Optional[str] = None) -> Variable
func GetVariable(ctx *Context, name string, id IDInput, state *VariableState, opts ...ResourceOption) (*Variable, error)
public static Variable Get(string name, Input<string> id, VariableState? state, CustomResourceOptions? opts = null)
public static Variable get(String name, Output<String> id, VariableState 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.
Package Details
- Repository
- HashiCorp Nomad pulumi/pulumi-nomad
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
nomad
Terraform Provider.