1. Packages
  2. Consul Provider
  3. API Docs
  4. getNetworkAreaMembers
Consul v3.12.4 published on Wednesday, Feb 12, 2025 by Pulumi

consul.getNetworkAreaMembers

Explore with Pulumi AI

NOTE: This feature requires Consul Enterprise.

The consul.getNetworkAreaMembers data source provides a list of the Consul servers present in a specific network area.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";

const dc2NetworkArea = new consul.NetworkArea("dc2", {
    peerDatacenter: "dc2",
    retryJoins: ["1.2.3.4"],
    useTls: true,
});
const dc2 = consul.getNetworkAreaMembersOutput({
    uuid: dc2NetworkArea.id,
});
export const members = dc2.apply(dc2 => dc2.members);
Copy
import pulumi
import pulumi_consul as consul

dc2_network_area = consul.NetworkArea("dc2",
    peer_datacenter="dc2",
    retry_joins=["1.2.3.4"],
    use_tls=True)
dc2 = consul.get_network_area_members_output(uuid=dc2_network_area.id)
pulumi.export("members", dc2.members)
Copy
package main

import (
	"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		dc2NetworkArea, err := consul.NewNetworkArea(ctx, "dc2", &consul.NetworkAreaArgs{
			PeerDatacenter: pulumi.String("dc2"),
			RetryJoins: pulumi.StringArray{
				pulumi.String("1.2.3.4"),
			},
			UseTls: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		dc2 := consul.GetNetworkAreaMembersOutput(ctx, consul.GetNetworkAreaMembersOutputArgs{
			Uuid: dc2NetworkArea.ID(),
		}, nil)
		ctx.Export("members", dc2.ApplyT(func(dc2 consul.GetNetworkAreaMembersResult) ([]consul.GetNetworkAreaMembersMember, error) {
			return []consul.GetNetworkAreaMembersMember(dc2.Members), nil
		}).([]consul.GetNetworkAreaMembersMemberOutput))
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Consul = Pulumi.Consul;

return await Deployment.RunAsync(() => 
{
    var dc2NetworkArea = new Consul.NetworkArea("dc2", new()
    {
        PeerDatacenter = "dc2",
        RetryJoins = new[]
        {
            "1.2.3.4",
        },
        UseTls = true,
    });

    var dc2 = Consul.GetNetworkAreaMembers.Invoke(new()
    {
        Uuid = dc2NetworkArea.Id,
    });

    return new Dictionary<string, object?>
    {
        ["members"] = dc2.Apply(getNetworkAreaMembersResult => getNetworkAreaMembersResult.Members),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.NetworkArea;
import com.pulumi.consul.NetworkAreaArgs;
import com.pulumi.consul.ConsulFunctions;
import com.pulumi.consul.inputs.GetNetworkAreaMembersArgs;
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 dc2NetworkArea = new NetworkArea("dc2NetworkArea", NetworkAreaArgs.builder()
            .peerDatacenter("dc2")
            .retryJoins("1.2.3.4")
            .useTls(true)
            .build());

        final var dc2 = ConsulFunctions.getNetworkAreaMembers(GetNetworkAreaMembersArgs.builder()
            .uuid(dc2NetworkArea.id())
            .build());

        ctx.export("members", dc2.applyValue(getNetworkAreaMembersResult -> getNetworkAreaMembersResult).applyValue(dc2 -> dc2.applyValue(getNetworkAreaMembersResult -> getNetworkAreaMembersResult.members())));
    }
}
Copy
resources:
  dc2NetworkArea:
    type: consul:NetworkArea
    name: dc2
    properties:
      peerDatacenter: dc2
      retryJoins:
        - 1.2.3.4
      useTls: true
variables:
  dc2:
    fn::invoke:
      function: consul:getNetworkAreaMembers
      arguments:
        uuid: ${dc2NetworkArea.id}
outputs:
  members: ${dc2.members}
Copy

Using getNetworkAreaMembers

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 getNetworkAreaMembers(args: GetNetworkAreaMembersArgs, opts?: InvokeOptions): Promise<GetNetworkAreaMembersResult>
function getNetworkAreaMembersOutput(args: GetNetworkAreaMembersOutputArgs, opts?: InvokeOptions): Output<GetNetworkAreaMembersResult>
Copy
def get_network_area_members(datacenter: Optional[str] = None,
                             token: Optional[str] = None,
                             uuid: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetNetworkAreaMembersResult
def get_network_area_members_output(datacenter: Optional[pulumi.Input[str]] = None,
                             token: Optional[pulumi.Input[str]] = None,
                             uuid: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetNetworkAreaMembersResult]
Copy
func GetNetworkAreaMembers(ctx *Context, args *GetNetworkAreaMembersArgs, opts ...InvokeOption) (*GetNetworkAreaMembersResult, error)
func GetNetworkAreaMembersOutput(ctx *Context, args *GetNetworkAreaMembersOutputArgs, opts ...InvokeOption) GetNetworkAreaMembersResultOutput
Copy

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

public static class GetNetworkAreaMembers 
{
    public static Task<GetNetworkAreaMembersResult> InvokeAsync(GetNetworkAreaMembersArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworkAreaMembersResult> Invoke(GetNetworkAreaMembersInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetNetworkAreaMembersResult> getNetworkAreaMembers(GetNetworkAreaMembersArgs args, InvokeOptions options)
public static Output<GetNetworkAreaMembersResult> getNetworkAreaMembers(GetNetworkAreaMembersArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: consul:index/getNetworkAreaMembers:getNetworkAreaMembers
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Uuid This property is required. string
The UUID of the area to list.
Datacenter string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
Token string
The ACL token to use. This overrides the token that the agent provides by default.

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

Uuid This property is required. string
The UUID of the area to list.
Datacenter string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
Token string
The ACL token to use. This overrides the token that the agent provides by default.

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

uuid This property is required. String
The UUID of the area to list.
datacenter String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
token String
The ACL token to use. This overrides the token that the agent provides by default.

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

uuid This property is required. string
The UUID of the area to list.
datacenter string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
token string
The ACL token to use. This overrides the token that the agent provides by default.

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

uuid This property is required. str
The UUID of the area to list.
datacenter str
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
token str
The ACL token to use. This overrides the token that the agent provides by default.

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

uuid This property is required. String
The UUID of the area to list.
datacenter String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
token String
The ACL token to use. This overrides the token that the agent provides by default.

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

getNetworkAreaMembers Result

The following output properties are available:

Datacenter string
The node's Consul datacenter.
Id string
The provider-assigned unique ID for this managed resource.
Members List<GetNetworkAreaMembersMember>
The list of Consul servers in this network area
Uuid string
The UUID of the Network Area being queried.
Token string

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

Datacenter string
The node's Consul datacenter.
Id string
The provider-assigned unique ID for this managed resource.
Members []GetNetworkAreaMembersMember
The list of Consul servers in this network area
Uuid string
The UUID of the Network Area being queried.
Token string

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

datacenter String
The node's Consul datacenter.
id String
The provider-assigned unique ID for this managed resource.
members List<GetNetworkAreaMembersMember>
The list of Consul servers in this network area
uuid String
The UUID of the Network Area being queried.
token String

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

datacenter string
The node's Consul datacenter.
id string
The provider-assigned unique ID for this managed resource.
members GetNetworkAreaMembersMember[]
The list of Consul servers in this network area
uuid string
The UUID of the Network Area being queried.
token string

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

datacenter str
The node's Consul datacenter.
id str
The provider-assigned unique ID for this managed resource.
members Sequence[GetNetworkAreaMembersMember]
The list of Consul servers in this network area
uuid str
The UUID of the Network Area being queried.
token str

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

datacenter String
The node's Consul datacenter.
id String
The provider-assigned unique ID for this managed resource.
members List<Property Map>
The list of Consul servers in this network area
uuid String
The UUID of the Network Area being queried.
token String

Deprecated: The token argument has been deprecated and will be removed in a future release. Please use the token argument in the provider configuration

Supporting Types

GetNetworkAreaMembersMember

Address This property is required. string
The IP address of the server.
Build This property is required. string
The Consul version running on the node.
Datacenter This property is required. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
Id This property is required. string
The node ID of the server.
Name This property is required. string
The node name of the server, with its datacenter appended.
Port This property is required. int
The server RPC port the node.
Protocol This property is required. int
The protocol version being spoken by the node.
Role This property is required. string
Role is always "server" since only Consul servers can participate in network areas.
Rtt This property is required. int
An estimated network round trip time from the server answering the query to the given server, in nanoseconds. This is computed using network coordinates.
Status This property is required. string
The current health status of the node, as determined by the network area distributed failure detector. This will be "alive", "leaving", or "failed". A "failed" status means that other servers are not able to probe this server over its server RPC interface.
Address This property is required. string
The IP address of the server.
Build This property is required. string
The Consul version running on the node.
Datacenter This property is required. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
Id This property is required. string
The node ID of the server.
Name This property is required. string
The node name of the server, with its datacenter appended.
Port This property is required. int
The server RPC port the node.
Protocol This property is required. int
The protocol version being spoken by the node.
Role This property is required. string
Role is always "server" since only Consul servers can participate in network areas.
Rtt This property is required. int
An estimated network round trip time from the server answering the query to the given server, in nanoseconds. This is computed using network coordinates.
Status This property is required. string
The current health status of the node, as determined by the network area distributed failure detector. This will be "alive", "leaving", or "failed". A "failed" status means that other servers are not able to probe this server over its server RPC interface.
address This property is required. String
The IP address of the server.
build This property is required. String
The Consul version running on the node.
datacenter This property is required. String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
id This property is required. String
The node ID of the server.
name This property is required. String
The node name of the server, with its datacenter appended.
port This property is required. Integer
The server RPC port the node.
protocol This property is required. Integer
The protocol version being spoken by the node.
role This property is required. String
Role is always "server" since only Consul servers can participate in network areas.
rtt This property is required. Integer
An estimated network round trip time from the server answering the query to the given server, in nanoseconds. This is computed using network coordinates.
status This property is required. String
The current health status of the node, as determined by the network area distributed failure detector. This will be "alive", "leaving", or "failed". A "failed" status means that other servers are not able to probe this server over its server RPC interface.
address This property is required. string
The IP address of the server.
build This property is required. string
The Consul version running on the node.
datacenter This property is required. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
id This property is required. string
The node ID of the server.
name This property is required. string
The node name of the server, with its datacenter appended.
port This property is required. number
The server RPC port the node.
protocol This property is required. number
The protocol version being spoken by the node.
role This property is required. string
Role is always "server" since only Consul servers can participate in network areas.
rtt This property is required. number
An estimated network round trip time from the server answering the query to the given server, in nanoseconds. This is computed using network coordinates.
status This property is required. string
The current health status of the node, as determined by the network area distributed failure detector. This will be "alive", "leaving", or "failed". A "failed" status means that other servers are not able to probe this server over its server RPC interface.
address This property is required. str
The IP address of the server.
build This property is required. str
The Consul version running on the node.
datacenter This property is required. str
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
id This property is required. str
The node ID of the server.
name This property is required. str
The node name of the server, with its datacenter appended.
port This property is required. int
The server RPC port the node.
protocol This property is required. int
The protocol version being spoken by the node.
role This property is required. str
Role is always "server" since only Consul servers can participate in network areas.
rtt This property is required. int
An estimated network round trip time from the server answering the query to the given server, in nanoseconds. This is computed using network coordinates.
status This property is required. str
The current health status of the node, as determined by the network area distributed failure detector. This will be "alive", "leaving", or "failed". A "failed" status means that other servers are not able to probe this server over its server RPC interface.
address This property is required. String
The IP address of the server.
build This property is required. String
The Consul version running on the node.
datacenter This property is required. String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
id This property is required. String
The node ID of the server.
name This property is required. String
The node name of the server, with its datacenter appended.
port This property is required. Number
The server RPC port the node.
protocol This property is required. Number
The protocol version being spoken by the node.
role This property is required. String
Role is always "server" since only Consul servers can participate in network areas.
rtt This property is required. Number
An estimated network round trip time from the server answering the query to the given server, in nanoseconds. This is computed using network coordinates.
status This property is required. String
The current health status of the node, as determined by the network area distributed failure detector. This will be "alive", "leaving", or "failed". A "failed" status means that other servers are not able to probe this server over its server RPC interface.

Package Details

Repository
HashiCorp Consul pulumi/pulumi-consul
License
Apache-2.0
Notes
This Pulumi package is based on the consul Terraform Provider.