1. Packages
  2. Consul Provider
  3. API Docs
  4. Peering
Consul v3.12.2 published on Wednesday, Oct 16, 2024 by Pulumi

consul.Peering

Explore with Pulumi AI

consul logo
Consul v3.12.2 published on Wednesday, Oct 16, 2024 by Pulumi

    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_name is used to reference the peer cluster in service discovery queries and configuration entries such as service-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_name is used to reference the peer cluster in service discovery queries and configuration entries such as service-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_name is used to reference the peer cluster in service discovery queries and configuration entries such as service-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_name is used to reference the peer cluster in service discovery queries and configuration entries such as service-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_name is used to reference the peer cluster in service discovery queries and configuration entries such as service-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_name is used to reference the peer cluster in service discovery queries and configuration entries such as service-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.
    PeerCaPems List<string>
    PeerId string
    PeerServerAddresses List<string>
    PeerServerName string
    State string
    DeletedAt string
    Id string
    The provider-assigned unique ID for this managed resource.
    PeerCaPems []string
    PeerId string
    PeerServerAddresses []string
    PeerServerName string
    State string
    deletedAt String
    id String
    The provider-assigned unique ID for this managed resource.
    peerCaPems List<String>
    peerId String
    peerServerAddresses List<String>
    peerServerName String
    state String
    deletedAt string
    id string
    The provider-assigned unique ID for this managed resource.
    peerCaPems string[]
    peerId string
    peerServerAddresses string[]
    peerServerName string
    state string
    deleted_at str
    id str
    The provider-assigned unique ID for this managed resource.
    peer_ca_pems Sequence[str]
    peer_id str
    peer_server_addresses Sequence[str]
    peer_server_name str
    state str
    deletedAt String
    id String
    The provider-assigned unique ID for this managed resource.
    peerCaPems List<String>
    peerId String
    peerServerAddresses List<String>
    peerServerName String
    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.
    The following state arguments are supported:
    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
    PeerCaPems List<string>
    PeerId string
    PeerName 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 as service-intentions. This field must be a valid DNS hostname label.
    PeerServerAddresses List<string>
    PeerServerName string
    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
    PeerCaPems []string
    PeerId string
    PeerName 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 as service-intentions. This field must be a valid DNS hostname label.
    PeerServerAddresses []string
    PeerServerName string
    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
    peerCaPems List<String>
    peerId String
    peerName 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 as service-intentions. This field must be a valid DNS hostname label.
    peerServerAddresses List<String>
    peerServerName String
    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
    peerCaPems string[]
    peerId string
    peerName 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 as service-intentions. This field must be a valid DNS hostname label.
    peerServerAddresses string[]
    peerServerName string
    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_pems Sequence[str]
    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 as service-intentions. This field must be a valid DNS hostname label.
    peer_server_addresses Sequence[str]
    peer_server_name str
    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
    peerCaPems List<String>
    peerId String
    peerName 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 as service-intentions. This field must be a valid DNS hostname label.
    peerServerAddresses List<String>
    peerServerName String
    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 consul Terraform Provider.
    consul logo
    Consul v3.12.2 published on Wednesday, Oct 16, 2024 by Pulumi