HashiCorp Nomad

v0.3.0 published on Tuesday, Sep 27, 2022 by Pulumi

getDatacenters

Retrieve a list of datacenters.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Nomad = Pulumi.Nomad;

return await Deployment.RunAsync(() => 
{
    var datacenters = Nomad.GetDatacenters.Invoke(new()
    {
        IgnoreDownNodes = true,
        Prefix = "prod",
    });

});
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.GetDatacenters(ctx, &GetDatacentersArgs{
			IgnoreDownNodes: pulumi.BoolRef(true),
			Prefix:          pulumi.StringRef("prod"),
		}, nil)
		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.NomadFunctions;
import com.pulumi.nomad.inputs.GetDatacentersArgs;
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) {
        final var datacenters = NomadFunctions.getDatacenters(GetDatacentersArgs.builder()
            .ignoreDownNodes(true)
            .prefix("prod")
            .build());

    }
}
import pulumi
import pulumi_nomad as nomad

datacenters = nomad.get_datacenters(ignore_down_nodes=True,
    prefix="prod")
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";

const datacenters = pulumi.output(nomad.getDatacenters({
    ignoreDownNodes: true,
    prefix: "prod",
}));
variables:
  datacenters:
    Fn::Invoke:
      Function: nomad:getDatacenters
      Arguments:
        ignoreDownNodes: true
        prefix: prod

Using getDatacenters

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 getDatacenters(args: GetDatacentersArgs, opts?: InvokeOptions): Promise<GetDatacentersResult>
function getDatacentersOutput(args: GetDatacentersOutputArgs, opts?: InvokeOptions): Output<GetDatacentersResult>
def get_datacenters(ignore_down_nodes: Optional[bool] = None,
                    prefix: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetDatacentersResult
def get_datacenters_output(ignore_down_nodes: Optional[pulumi.Input[bool]] = None,
                    prefix: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetDatacentersResult]
func GetDatacenters(ctx *Context, args *GetDatacentersArgs, opts ...InvokeOption) (*GetDatacentersResult, error)
func GetDatacentersOutput(ctx *Context, args *GetDatacentersOutputArgs, opts ...InvokeOption) GetDatacentersResultOutput

> Note: This function is named GetDatacenters in the Go SDK.

public static class GetDatacenters 
{
    public static Task<GetDatacentersResult> InvokeAsync(GetDatacentersArgs args, InvokeOptions? opts = null)
    public static Output<GetDatacentersResult> Invoke(GetDatacentersInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDatacentersResult> getDatacenters(GetDatacentersArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: nomad:index/getDatacenters:getDatacenters
  arguments:
    # arguments dictionary

The following arguments are supported:

IgnoreDownNodes bool

(bool: false): An optional flag that, if set to true will ignore down nodes when compiling the list of datacenters.

Prefix string

(string): An optional string to filter datacenters based on name prefix. If not provided, all datacenters are returned.

IgnoreDownNodes bool

(bool: false): An optional flag that, if set to true will ignore down nodes when compiling the list of datacenters.

Prefix string

(string): An optional string to filter datacenters based on name prefix. If not provided, all datacenters are returned.

ignoreDownNodes Boolean

(bool: false): An optional flag that, if set to true will ignore down nodes when compiling the list of datacenters.

prefix String

(string): An optional string to filter datacenters based on name prefix. If not provided, all datacenters are returned.

ignoreDownNodes boolean

(bool: false): An optional flag that, if set to true will ignore down nodes when compiling the list of datacenters.

prefix string

(string): An optional string to filter datacenters based on name prefix. If not provided, all datacenters are returned.

ignore_down_nodes bool

(bool: false): An optional flag that, if set to true will ignore down nodes when compiling the list of datacenters.

prefix str

(string): An optional string to filter datacenters based on name prefix. If not provided, all datacenters are returned.

ignoreDownNodes Boolean

(bool: false): An optional flag that, if set to true will ignore down nodes when compiling the list of datacenters.

prefix String

(string): An optional string to filter datacenters based on name prefix. If not provided, all datacenters are returned.

getDatacenters Result

The following output properties are available:

Datacenters List<string>
Id string

The provider-assigned unique ID for this managed resource.

IgnoreDownNodes bool
Prefix string
Datacenters []string
Id string

The provider-assigned unique ID for this managed resource.

IgnoreDownNodes bool
Prefix string
datacenters List<String>
id String

The provider-assigned unique ID for this managed resource.

ignoreDownNodes Boolean
prefix String
datacenters string[]
id string

The provider-assigned unique ID for this managed resource.

ignoreDownNodes boolean
prefix string
datacenters Sequence[str]
id str

The provider-assigned unique ID for this managed resource.

ignore_down_nodes bool
prefix str
datacenters List<String>
id String

The provider-assigned unique ID for this managed resource.

ignoreDownNodes Boolean
prefix String

Package Details

Repository
https://github.com/pulumi/pulumi-nomad
License
Apache-2.0
Notes

This Pulumi package is based on the nomad Terraform Provider.