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

consul.NetworkArea

Explore with Pulumi AI

NOTE: This feature requires Consul Enterprise.

The consul.NetworkArea resource manages a relationship between servers in two different Consul datacenters.

Unlike Consul’s WAN feature, network areas use just the server RPC port for communication, and relationships can be made between independent pairs of datacenters, so not all servers need to be fully connected. This allows for complex topologies among Consul datacenters like hub/spoke and more general trees.

Example Usage

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

const dc2 = new consul.NetworkArea("dc2", {
    peerDatacenter: "dc2",
    retryJoins: ["1.2.3.4"],
    useTls: true,
});
Copy
import pulumi
import pulumi_consul as consul

dc2 = consul.NetworkArea("dc2",
    peer_datacenter="dc2",
    retry_joins=["1.2.3.4"],
    use_tls=True)
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 {
		_, 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
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Consul = Pulumi.Consul;

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

});
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 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 dc2 = new NetworkArea("dc2", NetworkAreaArgs.builder()
            .peerDatacenter("dc2")
            .retryJoins("1.2.3.4")
            .useTls(true)
            .build());

    }
}
Copy
resources:
  dc2:
    type: consul:NetworkArea
    properties:
      peerDatacenter: dc2
      retryJoins:
        - 1.2.3.4
      useTls: true
Copy

Create NetworkArea Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new NetworkArea(name: string, args: NetworkAreaArgs, opts?: CustomResourceOptions);
@overload
def NetworkArea(resource_name: str,
                args: NetworkAreaArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def NetworkArea(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                peer_datacenter: Optional[str] = None,
                datacenter: Optional[str] = None,
                retry_joins: Optional[Sequence[str]] = None,
                token: Optional[str] = None,
                use_tls: Optional[bool] = None)
func NewNetworkArea(ctx *Context, name string, args NetworkAreaArgs, opts ...ResourceOption) (*NetworkArea, error)
public NetworkArea(string name, NetworkAreaArgs args, CustomResourceOptions? opts = null)
public NetworkArea(String name, NetworkAreaArgs args)
public NetworkArea(String name, NetworkAreaArgs args, CustomResourceOptions options)
type: consul:NetworkArea
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NetworkAreaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NetworkAreaArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkAreaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkAreaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NetworkAreaArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var networkAreaResource = new Consul.NetworkArea("networkAreaResource", new()
{
    PeerDatacenter = "string",
    Datacenter = "string",
    RetryJoins = new[]
    {
        "string",
    },
    UseTls = false,
});
Copy
example, err := consul.NewNetworkArea(ctx, "networkAreaResource", &consul.NetworkAreaArgs{
	PeerDatacenter: pulumi.String("string"),
	Datacenter:     pulumi.String("string"),
	RetryJoins: pulumi.StringArray{
		pulumi.String("string"),
	},
	UseTls: pulumi.Bool(false),
})
Copy
var networkAreaResource = new NetworkArea("networkAreaResource", NetworkAreaArgs.builder()
    .peerDatacenter("string")
    .datacenter("string")
    .retryJoins("string")
    .useTls(false)
    .build());
Copy
network_area_resource = consul.NetworkArea("networkAreaResource",
    peer_datacenter="string",
    datacenter="string",
    retry_joins=["string"],
    use_tls=False)
Copy
const networkAreaResource = new consul.NetworkArea("networkAreaResource", {
    peerDatacenter: "string",
    datacenter: "string",
    retryJoins: ["string"],
    useTls: false,
});
Copy
type: consul:NetworkArea
properties:
    datacenter: string
    peerDatacenter: string
    retryJoins:
        - string
    useTls: false
Copy

NetworkArea Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The NetworkArea resource accepts the following input properties:

PeerDatacenter
This property is required.
Changes to this property will trigger replacement.
string
The name of the Consul datacenter that will be joined to form the area.
Datacenter Changes to this property will trigger replacement. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
RetryJoins Changes to this property will trigger replacement. List<string>
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

UseTls bool
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
PeerDatacenter
This property is required.
Changes to this property will trigger replacement.
string
The name of the Consul datacenter that will be joined to form the area.
Datacenter Changes to this property will trigger replacement. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
RetryJoins Changes to this property will trigger replacement. []string
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

UseTls bool
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
peerDatacenter
This property is required.
Changes to this property will trigger replacement.
String
The name of the Consul datacenter that will be joined to form the area.
datacenter Changes to this property will trigger replacement. String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
retryJoins Changes to this property will trigger replacement. List<String>
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

useTls Boolean
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
peerDatacenter
This property is required.
Changes to this property will trigger replacement.
string
The name of the Consul datacenter that will be joined to form the area.
datacenter Changes to this property will trigger replacement. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
retryJoins Changes to this property will trigger replacement. string[]
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

useTls boolean
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
peer_datacenter
This property is required.
Changes to this property will trigger replacement.
str
The name of the Consul datacenter that will be joined to form the area.
datacenter Changes to this property will trigger replacement. str
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
retry_joins Changes to this property will trigger replacement. Sequence[str]
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

use_tls bool
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
peerDatacenter
This property is required.
Changes to this property will trigger replacement.
String
The name of the Consul datacenter that will be joined to form the area.
datacenter Changes to this property will trigger replacement. String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
retryJoins Changes to this property will trigger replacement. List<String>
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

useTls Boolean
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkArea resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing NetworkArea Resource

Get an existing NetworkArea resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NetworkAreaState, opts?: CustomResourceOptions): NetworkArea
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        datacenter: Optional[str] = None,
        peer_datacenter: Optional[str] = None,
        retry_joins: Optional[Sequence[str]] = None,
        token: Optional[str] = None,
        use_tls: Optional[bool] = None) -> NetworkArea
func GetNetworkArea(ctx *Context, name string, id IDInput, state *NetworkAreaState, opts ...ResourceOption) (*NetworkArea, error)
public static NetworkArea Get(string name, Input<string> id, NetworkAreaState? state, CustomResourceOptions? opts = null)
public static NetworkArea get(String name, Output<String> id, NetworkAreaState state, CustomResourceOptions options)
resources:  _:    type: consul:NetworkArea    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Datacenter Changes to this property will trigger replacement. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
PeerDatacenter Changes to this property will trigger replacement. string
The name of the Consul datacenter that will be joined to form the area.
RetryJoins Changes to this property will trigger replacement. List<string>
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

UseTls bool
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
Datacenter Changes to this property will trigger replacement. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
PeerDatacenter Changes to this property will trigger replacement. string
The name of the Consul datacenter that will be joined to form the area.
RetryJoins Changes to this property will trigger replacement. []string
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

UseTls bool
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
datacenter Changes to this property will trigger replacement. String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
peerDatacenter Changes to this property will trigger replacement. String
The name of the Consul datacenter that will be joined to form the area.
retryJoins Changes to this property will trigger replacement. List<String>
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

useTls Boolean
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
datacenter Changes to this property will trigger replacement. string
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
peerDatacenter Changes to this property will trigger replacement. string
The name of the Consul datacenter that will be joined to form the area.
retryJoins Changes to this property will trigger replacement. string[]
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

useTls boolean
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
datacenter Changes to this property will trigger replacement. str
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
peer_datacenter Changes to this property will trigger replacement. str
The name of the Consul datacenter that will be joined to form the area.
retry_joins Changes to this property will trigger replacement. Sequence[str]
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

use_tls bool
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.
datacenter Changes to this property will trigger replacement. String
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
peerDatacenter Changes to this property will trigger replacement. String
The name of the Consul datacenter that will be joined to form the area.
retryJoins Changes to this property will trigger replacement. List<String>
Specifies a list of Consul servers to attempt to join. Servers can be given as IP, IP:port, hostname, or hostname:port.
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

useTls Boolean
Specifies whether gossip over this area should be encrypted with TLS if possible. Defaults to false.

Package Details

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