Deprecated: getCatalogNodes has been deprecated in favor of getNodes
The consul.getNodes data source returns a list of Consul nodes that have
been registered with the Consul cluster in a given datacenter. By specifying a
different datacenter in the query_options it is possible to retrieve a list of
nodes from a different WAN-attached Consul datacenter.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
import * as example from "@pulumi/example";
import * as std from "@pulumi/std";
const read_dc1_nodes = consul.getNodes({
queryOptions: [{
datacenter: "dc1",
}],
});
// Set the description to a whitespace delimited list of the node names
const app = new example.index.Resource("app", {description: std.join({
separator: " ",
input: std.formatlist({
input: "%s",
args: [nodeNames],
}).result,
}).result});
import pulumi
import pulumi_consul as consul
import pulumi_example as example
import pulumi_std as std
read_dc1_nodes = consul.get_nodes(query_options=[{
"datacenter": "dc1",
}])
# Set the description to a whitespace delimited list of the node names
app = example.index.Resource("app", description=std.join(separator= ,
input=std.formatlist(input=%s,
args=[node_names]).result).result)
package main
import (
"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
"github.com/pulumi/pulumi-example/sdk/go/example"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := consul.GetNodes(ctx, &consul.GetNodesArgs{
QueryOptions: []consul.GetNodesQueryOption{
{
Datacenter: pulumi.StringRef("dc1"),
},
},
}, nil)
if err != nil {
return err
}
// Set the description to a whitespace delimited list of the node names
_, err = example.NewResource(ctx, "app", &example.ResourceArgs{
Description: std.Join(ctx, &std.JoinArgs{
Separator: " ",
Input: std.Formatlist(ctx, &std.FormatlistArgs{
Input: "%s",
Args: []interface{}{
nodeNames,
},
}, nil).Result,
}, nil).Result,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Consul = Pulumi.Consul;
using Example = Pulumi.Example;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var read_dc1_nodes = Consul.GetNodes.Invoke(new()
{
QueryOptions = new[]
{
new Consul.Inputs.GetNodesQueryOptionInputArgs
{
Datacenter = "dc1",
},
},
});
// Set the description to a whitespace delimited list of the node names
var app = new Example.Index.Resource("app", new()
{
Description = Std.Join.Invoke(new()
{
Separator = " ",
Input = Std.Formatlist.Invoke(new()
{
Input = "%s",
Args = new[]
{
nodeNames,
},
}).Result,
}).Result,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.ConsulFunctions;
import com.pulumi.consul.inputs.GetNodesArgs;
import com.pulumi.example.Resource;
import com.pulumi.example.ResourceArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FormatlistArgs;
import com.pulumi.std.inputs.JoinArgs;
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 read-dc1-nodes = ConsulFunctions.getNodes(GetNodesArgs.builder()
.queryOptions(GetNodesQueryOptionArgs.builder()
.datacenter("dc1")
.build())
.build());
// Set the description to a whitespace delimited list of the node names
var app = new Resource("app", ResourceArgs.builder()
.description(StdFunctions.join(JoinArgs.builder()
.separator(" ")
.input(StdFunctions.formatlist(FormatlistArgs.builder()
.input("%s")
.args(nodeNames)
.build()).result())
.build()).result())
.build());
}
}
resources:
# Set the description to a whitespace delimited list of the node names
app:
type: example:Resource
properties:
description:
fn::invoke:
function: std:join
arguments:
separator: ' '
input:
fn::invoke:
function: std:formatlist
arguments:
input: '%s'
args:
- ${nodeNames}
return: result
return: result
variables:
read-dc1-nodes:
fn::invoke:
function: consul:getNodes
arguments:
queryOptions:
- datacenter: dc1
Using getCatalogNodes
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 getCatalogNodes(args: GetCatalogNodesArgs, opts?: InvokeOptions): Promise<GetCatalogNodesResult>
function getCatalogNodesOutput(args: GetCatalogNodesOutputArgs, opts?: InvokeOptions): Output<GetCatalogNodesResult>def get_catalog_nodes(query_options: Optional[Sequence[GetCatalogNodesQueryOption]] = None,
opts: Optional[InvokeOptions] = None) -> GetCatalogNodesResult
def get_catalog_nodes_output(query_options: Optional[pulumi.Input[Sequence[pulumi.Input[GetCatalogNodesQueryOptionArgs]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCatalogNodesResult]func GetCatalogNodes(ctx *Context, args *GetCatalogNodesArgs, opts ...InvokeOption) (*GetCatalogNodesResult, error)
func GetCatalogNodesOutput(ctx *Context, args *GetCatalogNodesOutputArgs, opts ...InvokeOption) GetCatalogNodesResultOutput> Note: This function is named GetCatalogNodes in the Go SDK.
public static class GetCatalogNodes
{
public static Task<GetCatalogNodesResult> InvokeAsync(GetCatalogNodesArgs args, InvokeOptions? opts = null)
public static Output<GetCatalogNodesResult> Invoke(GetCatalogNodesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetCatalogNodesResult> getCatalogNodes(GetCatalogNodesArgs args, InvokeOptions options)
public static Output<GetCatalogNodesResult> getCatalogNodes(GetCatalogNodesArgs args, InvokeOptions options)
fn::invoke:
function: consul:index/getCatalogNodes:getCatalogNodes
arguments:
# arguments dictionaryThe following arguments are supported:
- Query
Options List<GetCatalog Nodes Query Option> - See below.
- Query
Options []GetCatalog Nodes Query Option - See below.
- query
Options List<GetCatalog Nodes Query Option> - See below.
- query
Options GetCatalog Nodes Query Option[] - See below.
- query
Options List<Property Map> - See below.
getCatalogNodes Result
The following output properties are available:
- Datacenter string
- The datacenter the keys are being read from to.
- Id string
- The provider-assigned unique ID for this managed resource.
- Node
Ids List<string> - A list of the Consul node IDs.
- Node
Names List<string> - A list of the Consul node names.
- Nodes
List<Get
Catalog Nodes Node> - A list of nodes and details about each Consul agent. The list of per-node attributes is detailed below.
- Query
Options List<GetCatalog Nodes Query Option>
- Datacenter string
- The datacenter the keys are being read from to.
- Id string
- The provider-assigned unique ID for this managed resource.
- Node
Ids []string - A list of the Consul node IDs.
- Node
Names []string - A list of the Consul node names.
- Nodes
[]Get
Catalog Nodes Node - A list of nodes and details about each Consul agent. The list of per-node attributes is detailed below.
- Query
Options []GetCatalog Nodes Query Option
- datacenter String
- The datacenter the keys are being read from to.
- id String
- The provider-assigned unique ID for this managed resource.
- node
Ids List<String> - A list of the Consul node IDs.
- node
Names List<String> - A list of the Consul node names.
- nodes
List<Get
Catalog Nodes Node> - A list of nodes and details about each Consul agent. The list of per-node attributes is detailed below.
- query
Options List<GetCatalog Nodes Query Option>
- datacenter string
- The datacenter the keys are being read from to.
- id string
- The provider-assigned unique ID for this managed resource.
- node
Ids string[] - A list of the Consul node IDs.
- node
Names string[] - A list of the Consul node names.
- nodes
Get
Catalog Nodes Node[] - A list of nodes and details about each Consul agent. The list of per-node attributes is detailed below.
- query
Options GetCatalog Nodes Query Option[]
- datacenter str
- The datacenter the keys are being read from to.
- id str
- The provider-assigned unique ID for this managed resource.
- node_
ids Sequence[str] - A list of the Consul node IDs.
- node_
names Sequence[str] - A list of the Consul node names.
- nodes
Sequence[Get
Catalog Nodes Node] - A list of nodes and details about each Consul agent. The list of per-node attributes is detailed below.
- query_
options Sequence[GetCatalog Nodes Query Option]
- datacenter String
- The datacenter the keys are being read from to.
- id String
- The provider-assigned unique ID for this managed resource.
- node
Ids List<String> - A list of the Consul node IDs.
- node
Names List<String> - A list of the Consul node names.
- nodes List<Property Map>
- A list of nodes and details about each Consul agent. The list of per-node attributes is detailed below.
- query
Options List<Property Map>
Supporting Types
GetCatalogNodesNode
- Address string
- Id string
- The Node ID of the Consul agent.
meta- Node meta data tag information, if any.name- The name of the Consul node.address- The IP address the node is advertising to the Consul cluster.tagged_addresses- List of explicit LAN and WAN IP addresses for the agent.
- Meta Dictionary<string, string>
- Name string
- Tagged
Addresses Dictionary<string, string>
- Address string
- Id string
- The Node ID of the Consul agent.
meta- Node meta data tag information, if any.name- The name of the Consul node.address- The IP address the node is advertising to the Consul cluster.tagged_addresses- List of explicit LAN and WAN IP addresses for the agent.
- Meta map[string]string
- Name string
- Tagged
Addresses map[string]string
- address String
- id String
- The Node ID of the Consul agent.
meta- Node meta data tag information, if any.name- The name of the Consul node.address- The IP address the node is advertising to the Consul cluster.tagged_addresses- List of explicit LAN and WAN IP addresses for the agent.
- meta Map<String,String>
- name String
- tagged
Addresses Map<String,String>
- address string
- id string
- The Node ID of the Consul agent.
meta- Node meta data tag information, if any.name- The name of the Consul node.address- The IP address the node is advertising to the Consul cluster.tagged_addresses- List of explicit LAN and WAN IP addresses for the agent.
- meta {[key: string]: string}
- name string
- tagged
Addresses {[key: string]: string}
- address str
- id str
- The Node ID of the Consul agent.
meta- Node meta data tag information, if any.name- The name of the Consul node.address- The IP address the node is advertising to the Consul cluster.tagged_addresses- List of explicit LAN and WAN IP addresses for the agent.
- meta Mapping[str, str]
- name str
- tagged_
addresses Mapping[str, str]
- address String
- id String
- The Node ID of the Consul agent.
meta- Node meta data tag information, if any.name- The name of the Consul node.address- The IP address the node is advertising to the Consul cluster.tagged_addresses- List of explicit LAN and WAN IP addresses for the agent.
- meta Map<String>
- name String
- tagged
Addresses Map<String>
GetCatalogNodesQueryOption
- Allow
Stale bool - When
true, the default, allow responses from Consul servers that are followers. - Datacenter string
- The Consul datacenter to query. Defaults to the
same value found in
query_optionsparameter specified below, or if that is empty, thedatacentervalue found in the Consul agent that this provider is configured to talk to then the datacenter in the provider setup. - Near string
- Node
Meta Dictionary<string, string> - Partition string
- Require
Consistent bool - When
trueforce the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse. - Token string
- Specify the Consul ACL token to use when performing the
request. This defaults to the same API token configured by the
consulprovider but may be overridden if necessary. - Wait
Index int - Index number used to enable blocking queries.
- Wait
Time string - Max time the client should wait for a blocking query to return.
- Allow
Stale bool - When
true, the default, allow responses from Consul servers that are followers. - Datacenter string
- The Consul datacenter to query. Defaults to the
same value found in
query_optionsparameter specified below, or if that is empty, thedatacentervalue found in the Consul agent that this provider is configured to talk to then the datacenter in the provider setup. - Near string
- Node
Meta map[string]string - Partition string
- Require
Consistent bool - When
trueforce the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse. - Token string
- Specify the Consul ACL token to use when performing the
request. This defaults to the same API token configured by the
consulprovider but may be overridden if necessary. - Wait
Index int - Index number used to enable blocking queries.
- Wait
Time string - Max time the client should wait for a blocking query to return.
- allow
Stale Boolean - When
true, the default, allow responses from Consul servers that are followers. - datacenter String
- The Consul datacenter to query. Defaults to the
same value found in
query_optionsparameter specified below, or if that is empty, thedatacentervalue found in the Consul agent that this provider is configured to talk to then the datacenter in the provider setup. - near String
- node
Meta Map<String,String> - partition String
- require
Consistent Boolean - When
trueforce the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse. - token String
- Specify the Consul ACL token to use when performing the
request. This defaults to the same API token configured by the
consulprovider but may be overridden if necessary. - wait
Index Integer - Index number used to enable blocking queries.
- wait
Time String - Max time the client should wait for a blocking query to return.
- allow
Stale boolean - When
true, the default, allow responses from Consul servers that are followers. - datacenter string
- The Consul datacenter to query. Defaults to the
same value found in
query_optionsparameter specified below, or if that is empty, thedatacentervalue found in the Consul agent that this provider is configured to talk to then the datacenter in the provider setup. - near string
- node
Meta {[key: string]: string} - partition string
- require
Consistent boolean - When
trueforce the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse. - token string
- Specify the Consul ACL token to use when performing the
request. This defaults to the same API token configured by the
consulprovider but may be overridden if necessary. - wait
Index number - Index number used to enable blocking queries.
- wait
Time string - Max time the client should wait for a blocking query to return.
- allow_
stale bool - When
true, the default, allow responses from Consul servers that are followers. - datacenter str
- The Consul datacenter to query. Defaults to the
same value found in
query_optionsparameter specified below, or if that is empty, thedatacentervalue found in the Consul agent that this provider is configured to talk to then the datacenter in the provider setup. - near str
- node_
meta Mapping[str, str] - partition str
- require_
consistent bool - When
trueforce the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse. - token str
- Specify the Consul ACL token to use when performing the
request. This defaults to the same API token configured by the
consulprovider but may be overridden if necessary. - wait_
index int - Index number used to enable blocking queries.
- wait_
time str - Max time the client should wait for a blocking query to return.
- allow
Stale Boolean - When
true, the default, allow responses from Consul servers that are followers. - datacenter String
- The Consul datacenter to query. Defaults to the
same value found in
query_optionsparameter specified below, or if that is empty, thedatacentervalue found in the Consul agent that this provider is configured to talk to then the datacenter in the provider setup. - near String
- node
Meta Map<String> - partition String
- require
Consistent Boolean - When
trueforce the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse. - token String
- Specify the Consul ACL token to use when performing the
request. This defaults to the same API token configured by the
consulprovider but may be overridden if necessary. - wait
Index Number - Index number used to enable blocking queries.
- wait
Time String - Max time the client should wait for a blocking query to return.
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consulTerraform Provider.
