Nomad v2.3.0 published on Wednesday, Jun 5, 2024 by Pulumi
nomad.getRegions
Explore with Pulumi AI
Retrieve a list of regions available in Nomad.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
function notImplemented(message: string) {
throw new Error(message);
}
export = async () => {
const myRegions = await nomad.getRegions({});
const jobs = notImplemented("The template_file data resource is not yet supported.");
const app: nomad.Job[] = [];
for (const range = {value: 0}; range.value < myRegions.regions.length; range.value++) {
app.push(new nomad.Job(`app-${range.value}`, {jobspec: jobs[range.value].rendered}));
}
}
import pulumi
import pulumi_nomad as nomad
def not_implemented(msg):
raise NotImplementedError(msg)
my_regions = nomad.get_regions()
jobs = not_implemented("The template_file data resource is not yet supported.")
app = []
for range in [{"value": i} for i in range(0, len(my_regions.regions))]:
app.append(nomad.Job(f"app-{range['value']}", jobspec=jobs[range["value"]]["rendered"]))
package main
import (
"github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func notImplemented(message string) pulumi.AnyOutput {
panic(message)
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myRegions, err := nomad.GetRegions(ctx, nil, nil)
if err != nil {
return err
}
jobs := notImplemented("The template_file data resource is not yet supported.")
var app []*nomad.Job
for index := 0; index < len(myRegions.Regions); index++ {
key0 := index
val0 := index
__res, err := nomad.NewJob(ctx, fmt.Sprintf("app-%v", key0), &nomad.JobArgs{
Jobspec: jobs[val0].Rendered,
})
if err != nil {
return err
}
app = append(app, __res)
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Pulumi;
using Nomad = Pulumi.Nomad;
object NotImplemented(string errorMessage)
{
throw new System.NotImplementedException(errorMessage);
}
return await Deployment.RunAsync(async() =>
{
var myRegions = await Nomad.GetRegions.InvokeAsync();
var jobs = NotImplemented("The template_file data resource is not yet supported.");
var app = new List<Nomad.Job>();
for (var rangeIndex = 0; rangeIndex < myRegions.Regions.Length; rangeIndex++)
{
var range = new { Value = rangeIndex };
app.Add(new Nomad.Job($"app-{range.Value}", new()
{
Jobspec = jobs[range.Value].Rendered,
}));
}
});
Coming soon!
Coming soon!
Using getRegions
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRegions(opts?: InvokeOptions): Promise<GetRegionsResult>
function getRegionsOutput(opts?: InvokeOptions): Output<GetRegionsResult>
def get_regions(opts: Optional[InvokeOptions] = None) -> GetRegionsResult
def get_regions_output(opts: Optional[InvokeOptions] = None) -> Output[GetRegionsResult]
func GetRegions(ctx *Context, opts ...InvokeOption) (*GetRegionsResult, error)
func GetRegionsOutput(ctx *Context, opts ...InvokeOption) GetRegionsResultOutput
> Note: This function is named GetRegions
in the Go SDK.
public static class GetRegions
{
public static Task<GetRegionsResult> InvokeAsync(InvokeOptions? opts = null)
public static Output<GetRegionsResult> Invoke(InvokeOptions? opts = null)
}
public static CompletableFuture<GetRegionsResult> getRegions(InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: nomad:index/getRegions:getRegions
arguments:
# arguments dictionary
getRegions Result
The following output properties are available:
Package Details
- Repository
- HashiCorp Nomad pulumi/pulumi-nomad
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
nomad
Terraform Provider.