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,
});
import pulumi
import pulumi_consul as consul
dc2 = consul.NetworkArea("dc2",
peer_datacenter="dc2",
retry_joins=["1.2.3.4"],
use_tls=True)
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
})
}
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,
});
});
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());
}
}
resources:
dc2:
type: consul:NetworkArea
properties:
peerDatacenter: dc2
retryJoins:
- 1.2.3.4
useTls: true
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 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.
- args 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 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.
- name String
- The unique name of the resource.
- args 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,
});
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),
})
var networkAreaResource = new NetworkArea("networkAreaResource", NetworkAreaArgs.builder()
.peerDatacenter("string")
.datacenter("string")
.retryJoins("string")
.useTls(false)
.build());
network_area_resource = consul.NetworkArea("networkAreaResource",
peer_datacenter="string",
datacenter="string",
retry_joins=["string"],
use_tls=False)
const networkAreaResource = new consul.NetworkArea("networkAreaResource", {
peerDatacenter: "string",
datacenter: "string",
retryJoins: ["string"],
useTls: false,
});
type: consul:NetworkArea
properties:
datacenter: string
peerDatacenter: string
retryJoins:
- string
useTls: false
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
The NetworkArea resource accepts the following input properties:
- Peer
Datacenter 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.
- Retry
Joins List<string> - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - Token string
- 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
.
- Peer
Datacenter 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.
- Retry
Joins []string - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - Token string
- 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
.
- peer
Datacenter 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.
- retry
Joins List<String> - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - token String
- The ACL token to use. This overrides the token that the agent provides by default.
- use
Tls Boolean - Specifies whether gossip over this area should be
encrypted with TLS if possible. Defaults to
false
.
- peer
Datacenter 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.
- retry
Joins string[] - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - token string
- The ACL token to use. This overrides the token that the agent provides by default.
- use
Tls 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
, orhostname: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
.
- peer
Datacenter 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.
- retry
Joins List<String> - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - token String
- The ACL token to use. This overrides the token that the agent provides by default.
- use
Tls 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)
Resource lookup is not supported in YAML
- 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.
- 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.
- Datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- Peer
Datacenter string - The name of the Consul datacenter that will be joined to form the area.
- Retry
Joins List<string> - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - Token string
- 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
.
- Datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- Peer
Datacenter string - The name of the Consul datacenter that will be joined to form the area.
- Retry
Joins []string - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - Token string
- 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
.
- datacenter String
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- peer
Datacenter String - The name of the Consul datacenter that will be joined to form the area.
- retry
Joins List<String> - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - token String
- The ACL token to use. This overrides the token that the agent provides by default.
- use
Tls Boolean - 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.
- peer
Datacenter string - The name of the Consul datacenter that will be joined to form the area.
- retry
Joins string[] - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - token string
- The ACL token to use. This overrides the token that the agent provides by default.
- use
Tls 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
, orhostname: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
.
- datacenter String
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- peer
Datacenter String - The name of the Consul datacenter that will be joined to form the area.
- retry
Joins List<String> - Specifies a list of Consul servers to attempt to
join. Servers can be given as
IP
,IP:port
,hostname
, orhostname:port
. - token String
- The ACL token to use. This overrides the token that the agent provides by default.
- use
Tls 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.