consul.Peering
Explore with Pulumi AI
Cluster Peering can be used to create connections between two or more independent clusters so that services deployed to different partitions or datacenters can communicate.
The cluster_peering resource can be used to establish the peering after a peering token has been generated.
Cluster peering is currently in technical preview: Functionality associated with cluster peering is subject to change. You should never use the technical preview release in secure environments or production scenarios. Features in technical preview may have performance issues, scaling issues, and limited support.
The functionality described here is available only in Consul version 1.13.0 and later.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
const eu_us = new consul.PeeringToken("eu-us", {peerName: "eu-cluster"});
const eu_usPeering = new consul.Peering("eu-us", {
    peerName: "eu-cluster",
    peeringToken: token.peeringToken,
    meta: {
        hello: "world",
    },
});
import pulumi
import pulumi_consul as consul
eu_us = consul.PeeringToken("eu-us", peer_name="eu-cluster")
eu_us_peering = consul.Peering("eu-us",
    peer_name="eu-cluster",
    peering_token=token["peeringToken"],
    meta={
        "hello": "world",
    })
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.NewPeeringToken(ctx, "eu-us", &consul.PeeringTokenArgs{
			PeerName: pulumi.String("eu-cluster"),
		})
		if err != nil {
			return err
		}
		_, err = consul.NewPeering(ctx, "eu-us", &consul.PeeringArgs{
			PeerName:     pulumi.String("eu-cluster"),
			PeeringToken: pulumi.Any(token.PeeringToken),
			Meta: pulumi.StringMap{
				"hello": pulumi.String("world"),
			},
		})
		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 eu_us = new Consul.PeeringToken("eu-us", new()
    {
        PeerName = "eu-cluster",
    });
    var eu_usPeering = new Consul.Peering("eu-us", new()
    {
        PeerName = "eu-cluster",
        PeeringToken = token.PeeringToken,
        Meta = 
        {
            { "hello", "world" },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.PeeringToken;
import com.pulumi.consul.PeeringTokenArgs;
import com.pulumi.consul.Peering;
import com.pulumi.consul.PeeringArgs;
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 eu_us = new PeeringToken("eu-us", PeeringTokenArgs.builder()
            .peerName("eu-cluster")
            .build());
        var eu_usPeering = new Peering("eu-usPeering", PeeringArgs.builder()
            .peerName("eu-cluster")
            .peeringToken(token.peeringToken())
            .meta(Map.of("hello", "world"))
            .build());
    }
}
resources:
  eu-us:
    type: consul:PeeringToken
    properties:
      peerName: eu-cluster
  eu-usPeering:
    type: consul:Peering
    name: eu-us
    properties:
      peerName: eu-cluster
      peeringToken: ${token.peeringToken}
      meta:
        hello: world
Create Peering Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Peering(name: string, args: PeeringArgs, opts?: CustomResourceOptions);@overload
def Peering(resource_name: str,
            args: PeeringArgs,
            opts: Optional[ResourceOptions] = None)
@overload
def Peering(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            peer_name: Optional[str] = None,
            peering_token: Optional[str] = None,
            meta: Optional[Mapping[str, str]] = None,
            partition: Optional[str] = None)func NewPeering(ctx *Context, name string, args PeeringArgs, opts ...ResourceOption) (*Peering, error)public Peering(string name, PeeringArgs args, CustomResourceOptions? opts = null)
public Peering(String name, PeeringArgs args)
public Peering(String name, PeeringArgs args, CustomResourceOptions options)
type: consul:Peering
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 PeeringArgs
- 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 PeeringArgs
- 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 PeeringArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PeeringArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PeeringArgs
- 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 peeringResource = new Consul.Peering("peeringResource", new()
{
    PeerName = "string",
    PeeringToken = "string",
    Meta = 
    {
        { "string", "string" },
    },
    Partition = "string",
});
example, err := consul.NewPeering(ctx, "peeringResource", &consul.PeeringArgs{
	PeerName:     pulumi.String("string"),
	PeeringToken: pulumi.String("string"),
	Meta: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Partition: pulumi.String("string"),
})
var peeringResource = new Peering("peeringResource", PeeringArgs.builder()
    .peerName("string")
    .peeringToken("string")
    .meta(Map.of("string", "string"))
    .partition("string")
    .build());
peering_resource = consul.Peering("peeringResource",
    peer_name="string",
    peering_token="string",
    meta={
        "string": "string",
    },
    partition="string")
const peeringResource = new consul.Peering("peeringResource", {
    peerName: "string",
    peeringToken: "string",
    meta: {
        string: "string",
    },
    partition: "string",
});
type: consul:Peering
properties:
    meta:
        string: string
    partition: string
    peerName: string
    peeringToken: string
Peering 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 Peering resource accepts the following input properties:
- PeerName string
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- PeeringToken string
- The peering token fetched from the peer cluster.
- Meta Dictionary<string, string>
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- Partition string
- PeerName string
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- PeeringToken string
- The peering token fetched from the peer cluster.
- Meta map[string]string
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- Partition string
- peerName String
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peeringToken String
- The peering token fetched from the peer cluster.
- meta Map<String,String>
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition String
- peerName string
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peeringToken string
- The peering token fetched from the peer cluster.
- meta {[key: string]: string}
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition string
- peer_name str
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peering_token str
- The peering token fetched from the peer cluster.
- meta Mapping[str, str]
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition str
- peerName String
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peeringToken String
- The peering token fetched from the peer cluster.
- meta Map<String>
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition String
Outputs
All input properties are implicitly available as output properties. Additionally, the Peering resource produces the following output properties:
- DeletedAt string
- Id string
- The provider-assigned unique ID for this managed resource.
- PeerCa List<string>Pems 
- PeerId string
- PeerServer List<string>Addresses 
- PeerServer stringName 
- State string
- DeletedAt string
- Id string
- The provider-assigned unique ID for this managed resource.
- PeerCa []stringPems 
- PeerId string
- PeerServer []stringAddresses 
- PeerServer stringName 
- State string
- deletedAt String
- id String
- The provider-assigned unique ID for this managed resource.
- peerCa List<String>Pems 
- peerId String
- peerServer List<String>Addresses 
- peerServer StringName 
- state String
- deletedAt string
- id string
- The provider-assigned unique ID for this managed resource.
- peerCa string[]Pems 
- peerId string
- peerServer string[]Addresses 
- peerServer stringName 
- state string
- deleted_at str
- id str
- The provider-assigned unique ID for this managed resource.
- peer_ca_ Sequence[str]pems 
- peer_id str
- peer_server_ Sequence[str]addresses 
- peer_server_ strname 
- state str
- deletedAt String
- id String
- The provider-assigned unique ID for this managed resource.
- peerCa List<String>Pems 
- peerId String
- peerServer List<String>Addresses 
- peerServer StringName 
- state String
Look up Existing Peering Resource
Get an existing Peering 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?: PeeringState, opts?: CustomResourceOptions): Peering@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        deleted_at: Optional[str] = None,
        meta: Optional[Mapping[str, str]] = None,
        partition: Optional[str] = None,
        peer_ca_pems: Optional[Sequence[str]] = None,
        peer_id: Optional[str] = None,
        peer_name: Optional[str] = None,
        peer_server_addresses: Optional[Sequence[str]] = None,
        peer_server_name: Optional[str] = None,
        peering_token: Optional[str] = None,
        state: Optional[str] = None) -> Peeringfunc GetPeering(ctx *Context, name string, id IDInput, state *PeeringState, opts ...ResourceOption) (*Peering, error)public static Peering Get(string name, Input<string> id, PeeringState? state, CustomResourceOptions? opts = null)public static Peering get(String name, Output<String> id, PeeringState state, CustomResourceOptions options)resources:  _:    type: consul:Peering    get:      id: ${id}- 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.
- DeletedAt string
- Meta Dictionary<string, string>
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- Partition string
- PeerCa List<string>Pems 
- PeerId string
- PeerName string
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- PeerServer List<string>Addresses 
- PeerServer stringName 
- PeeringToken string
- The peering token fetched from the peer cluster.
- State string
- DeletedAt string
- Meta map[string]string
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- Partition string
- PeerCa []stringPems 
- PeerId string
- PeerName string
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- PeerServer []stringAddresses 
- PeerServer stringName 
- PeeringToken string
- The peering token fetched from the peer cluster.
- State string
- deletedAt String
- meta Map<String,String>
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition String
- peerCa List<String>Pems 
- peerId String
- peerName String
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peerServer List<String>Addresses 
- peerServer StringName 
- peeringToken String
- The peering token fetched from the peer cluster.
- state String
- deletedAt string
- meta {[key: string]: string}
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition string
- peerCa string[]Pems 
- peerId string
- peerName string
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peerServer string[]Addresses 
- peerServer stringName 
- peeringToken string
- The peering token fetched from the peer cluster.
- state string
- deleted_at str
- meta Mapping[str, str]
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition str
- peer_ca_ Sequence[str]pems 
- peer_id str
- peer_name str
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peer_server_ Sequence[str]addresses 
- peer_server_ strname 
- peering_token str
- The peering token fetched from the peer cluster.
- state str
- deletedAt String
- meta Map<String>
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
- partition String
- peerCa List<String>Pems 
- peerId String
- peerName String
- The name assigned to the peer cluster. The peer_nameis used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions. This field must be a valid DNS hostname label.
- peerServer List<String>Addresses 
- peerServer StringName 
- peeringToken String
- The peering token fetched from the peer cluster.
- state String
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the consulTerraform Provider.