Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

NetworkArea

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

using Pulumi;
using Consul = Pulumi.Consul;

class MyStack : Stack
{
    public MyStack()
    {
        var dc2 = new Consul.NetworkArea("dc2", new Consul.NetworkAreaArgs
        {
            PeerDatacenter = "dc2",
            RetryJoins = 
            {
                "1.2.3.4",
            },
            UseTls = true,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-consul/sdk/v2/go/consul"
    "github.com/pulumi/pulumi/sdk/v2/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
    })
}
import pulumi
import pulumi_consul as consul

dc2 = consul.NetworkArea("dc2",
    peer_datacenter="dc2",
    retry_joins=["1.2.3.4"],
    use_tls=True)
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,
});

Create a NetworkArea Resource

new NetworkArea(name: string, args: NetworkAreaArgs, opts?: CustomResourceOptions);
def NetworkArea(resource_name: 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)
func NewNetworkArea(ctx *Context, name string, args NetworkAreaArgs, opts ...ResourceOption) (*NetworkArea, error)
public NetworkArea(string name, NetworkAreaArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args NetworkAreaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NetworkAreaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkAreaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

NetworkArea Resource Properties

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

Inputs

The NetworkArea resource accepts the following input properties:

PeerDatacenter string

The name of the Consul datacenter that will be joined to form the area.

Datacenter string

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

RetryJoins 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.

UseTls bool

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

PeerDatacenter string

The name of the Consul datacenter that will be joined to form the area.

Datacenter string

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

RetryJoins []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.

UseTls bool

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

peerDatacenter string

The name of the Consul datacenter that will be joined to form the area.

datacenter string

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

retryJoins 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.

useTls boolean

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

peer_datacenter str

The name of the Consul datacenter that will be joined to form the area.

datacenter str

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

retry_joins 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.

use_tls bool

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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 string

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

PeerDatacenter string

The name of the Consul datacenter that will be joined to form the area.

RetryJoins 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.

UseTls bool

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

Datacenter string

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

PeerDatacenter string

The name of the Consul datacenter that will be joined to form the area.

RetryJoins []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.

UseTls bool

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

datacenter string

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

peerDatacenter string

The name of the Consul datacenter that will be joined to form the area.

retryJoins 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.

useTls boolean

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

datacenter str

The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.

peer_datacenter str

The name of the Consul datacenter that will be joined to form the area.

retry_joins 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.

use_tls bool

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

Package Details

Repository
https://github.com/pulumi/pulumi-consul
License
Apache-2.0
Notes
This Pulumi package is based on the consul Terraform Provider.