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
The Peering resource accepts the following input properties:
- Peer
Name string - The name assigned to the peer cluster. The
peer_name
is 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 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
- Peer
Name string - The name assigned to the peer cluster. The
peer_name
is 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 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
- peer
Name String - The name assigned to the peer cluster. The
peer_name
is 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 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
- peer
Name string - The name assigned to the peer cluster. The
peer_name
is 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 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_name
is 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
- peer
Name String - The name assigned to the peer cluster. The
peer_name
is 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 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:
- Deleted
At string - Id string
- The provider-assigned unique ID for this managed resource.
- Peer
Ca List<string>Pems - Peer
Id string - Peer
Server List<string>Addresses - Peer
Server stringName - State string
- Deleted
At string - Id string
- The provider-assigned unique ID for this managed resource.
- Peer
Ca []stringPems - Peer
Id string - Peer
Server []stringAddresses - Peer
Server stringName - State string
- deleted
At String - id String
- The provider-assigned unique ID for this managed resource.
- peer
Ca List<String>Pems - peer
Id String - peer
Server List<String>Addresses - peer
Server StringName - state String
- deleted
At string - id string
- The provider-assigned unique ID for this managed resource.
- peer
Ca string[]Pems - peer
Id string - peer
Server string[]Addresses - peer
Server 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
- deleted
At String - id String
- The provider-assigned unique ID for this managed resource.
- peer
Ca List<String>Pems - peer
Id String - peer
Server List<String>Addresses - peer
Server 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) -> Peering
func 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)
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.
- Deleted
At 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
- Peer
Ca List<string>Pems - Peer
Id string - Peer
Name string - The name assigned to the peer cluster. The
peer_name
is 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 List<string>Addresses - Peer
Server stringName - Peering
Token string - The peering token fetched from the peer cluster.
- State string
- Deleted
At 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
- Peer
Ca []stringPems - Peer
Id string - Peer
Name string - The name assigned to the peer cluster. The
peer_name
is 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 []stringAddresses - Peer
Server stringName - Peering
Token string - The peering token fetched from the peer cluster.
- State string
- deleted
At 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
- peer
Ca List<String>Pems - peer
Id String - peer
Name String - The name assigned to the peer cluster. The
peer_name
is 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 List<String>Addresses - peer
Server StringName - peering
Token String - The peering token fetched from the peer cluster.
- state String
- deleted
At 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
- peer
Ca string[]Pems - peer
Id string - peer
Name string - The name assigned to the peer cluster. The
peer_name
is 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 string[]Addresses - peer
Server stringName - peering
Token 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_name
is 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
- deleted
At 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
- peer
Ca List<String>Pems - peer
Id String - peer
Name String - The name assigned to the peer cluster. The
peer_name
is 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 List<String>Addresses - peer
Server StringName - peering
Token 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
consul
Terraform Provider.