1. Packages
  2. Nomad Provider
  3. API Docs
  4. getDatacenters
Nomad v2.4.1 published on Wednesday, Oct 30, 2024 by Pulumi

nomad.getDatacenters

Explore with Pulumi AI

nomad logo
Nomad v2.4.1 published on Wednesday, Oct 30, 2024 by Pulumi

    Retrieve a list of datacenters.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nomad from "@pulumi/nomad";
    
    const datacenters = nomad.getDatacenters({
        prefix: "prod",
        ignoreDownNodes: true,
    });
    
    import pulumi
    import pulumi_nomad as nomad
    
    datacenters = nomad.get_datacenters(prefix="prod",
        ignore_down_nodes=True)
    
    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.GetDatacenters(ctx, &nomad.GetDatacentersArgs{
    			Prefix:          pulumi.StringRef("prod"),
    			IgnoreDownNodes: pulumi.BoolRef(true),
    		}, nil)
    		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 datacenters = Nomad.GetDatacenters.Invoke(new()
        {
            Prefix = "prod",
            IgnoreDownNodes = true,
        });
    
    });
    
    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()
                .prefix("prod")
                .ignoreDownNodes(true)
                .build());
    
        }
    }
    
    variables:
      datacenters:
        fn::invoke:
          Function: nomad:getDatacenters
          Arguments:
            prefix: prod
            ignoreDownNodes: true
    

    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>
    list(string) a list of datacenters.
    Id string
    The provider-assigned unique ID for this managed resource.
    IgnoreDownNodes bool
    Prefix string
    Datacenters []string
    list(string) a list of datacenters.
    Id string
    The provider-assigned unique ID for this managed resource.
    IgnoreDownNodes bool
    Prefix string
    datacenters List<String>
    list(string) a list of datacenters.
    id String
    The provider-assigned unique ID for this managed resource.
    ignoreDownNodes Boolean
    prefix String
    datacenters string[]
    list(string) a list of datacenters.
    id string
    The provider-assigned unique ID for this managed resource.
    ignoreDownNodes boolean
    prefix string
    datacenters Sequence[str]
    list(string) a list of datacenters.
    id str
    The provider-assigned unique ID for this managed resource.
    ignore_down_nodes bool
    prefix str
    datacenters List<String>
    list(string) a list of datacenters.
    id String
    The provider-assigned unique ID for this managed resource.
    ignoreDownNodes Boolean
    prefix String

    Package Details

    Repository
    HashiCorp Nomad pulumi/pulumi-nomad
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the nomad Terraform Provider.
    nomad logo
    Nomad v2.4.1 published on Wednesday, Oct 30, 2024 by Pulumi