1. Packages
  2. HashiCorp Consul
  3. API Docs
  4. Peering
Consul v3.11.1 published on Friday, Jan 19, 2024 by Pulumi

consul.Peering

Explore with Pulumi AI

consul logo
Consul v3.11.1 published on Friday, Jan 19, 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

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a peering between the EU and US Consul clusters
        var eu = new Consul.Provider("eu", new()
        {
            Address = "eu-cluster:8500",
        });
    
        var us = new Consul.Provider("us", new()
        {
            Address = "us-cluster:8500",
        });
    
        var eu_usPeeringToken = new Consul.PeeringToken("eu-usPeeringToken", new()
        {
            PeerName = "eu-cluster",
        }, new CustomResourceOptions
        {
            Provider = consul.Us,
        });
    
        var eu_usPeering = new Consul.Peering("eu-usPeering", new()
        {
            PeerName = "eu-cluster",
            PeeringToken = consul_peering_token.Token.Peering_token,
            Meta = 
            {
                { "hello", "world" },
            },
        }, new CustomResourceOptions
        {
            Provider = consul.Eu,
        });
    
    });
    
    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.NewProvider(ctx, "eu", &consul.ProviderArgs{
    			Address: pulumi.String("eu-cluster:8500"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = consul.NewProvider(ctx, "us", &consul.ProviderArgs{
    			Address: pulumi.String("us-cluster:8500"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = consul.NewPeeringToken(ctx, "eu-usPeeringToken", &consul.PeeringTokenArgs{
    			PeerName: pulumi.String("eu-cluster"),
    		}, pulumi.Provider(consul.Us))
    		if err != nil {
    			return err
    		}
    		_, err = consul.NewPeering(ctx, "eu-usPeering", &consul.PeeringArgs{
    			PeerName:     pulumi.String("eu-cluster"),
    			PeeringToken: pulumi.Any(consul_peering_token.Token.Peering_token),
    			Meta: pulumi.StringMap{
    				"hello": pulumi.String("world"),
    			},
    		}, pulumi.Provider(consul.Eu))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.Provider;
    import com.pulumi.consul.ProviderArgs;
    import com.pulumi.consul.PeeringToken;
    import com.pulumi.consul.PeeringTokenArgs;
    import com.pulumi.consul.Peering;
    import com.pulumi.consul.PeeringArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 = new Provider("eu", ProviderArgs.builder()        
                .address("eu-cluster:8500")
                .build());
    
            var us = new Provider("us", ProviderArgs.builder()        
                .address("us-cluster:8500")
                .build());
    
            var eu_usPeeringToken = new PeeringToken("eu-usPeeringToken", PeeringTokenArgs.builder()        
                .peerName("eu-cluster")
                .build(), CustomResourceOptions.builder()
                    .provider(consul.us())
                    .build());
    
            var eu_usPeering = new Peering("eu-usPeering", PeeringArgs.builder()        
                .peerName("eu-cluster")
                .peeringToken(consul_peering_token.token().peering_token())
                .meta(Map.of("hello", "world"))
                .build(), CustomResourceOptions.builder()
                    .provider(consul.eu())
                    .build());
    
        }
    }
    
    import pulumi
    import pulumi_consul as consul
    
    # Create a peering between the EU and US Consul clusters
    eu = consul.Provider("eu", address="eu-cluster:8500")
    us = consul.Provider("us", address="us-cluster:8500")
    eu_us_peering_token = consul.PeeringToken("eu-usPeeringToken", peer_name="eu-cluster",
    opts=pulumi.ResourceOptions(provider=consul["us"]))
    eu_us_peering = consul.Peering("eu-usPeering",
        peer_name="eu-cluster",
        peering_token=consul_peering_token["token"]["peering_token"],
        meta={
            "hello": "world",
        },
        opts=pulumi.ResourceOptions(provider=consul["eu"]))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    // Create a peering between the EU and US Consul clusters
    const eu = new consul.Provider("eu", {address: "eu-cluster:8500"});
    const us = new consul.Provider("us", {address: "us-cluster:8500"});
    const eu_usPeeringToken = new consul.PeeringToken("eu-usPeeringToken", {peerName: "eu-cluster"}, {
        provider: consul.us,
    });
    const eu_usPeering = new consul.Peering("eu-usPeering", {
        peerName: "eu-cluster",
        peeringToken: consul_peering_token.token.peering_token,
        meta: {
            hello: "world",
        },
    }, {
        provider: consul.eu,
    });
    
    resources:
      # Create a peering between the EU and US Consul clusters
      eu:
        type: pulumi:providers:consul
        properties:
          address: eu-cluster:8500
      us:
        type: pulumi:providers:consul
        properties:
          address: us-cluster:8500
      eu-usPeeringToken:
        type: consul:PeeringToken
        properties:
          peerName: eu-cluster
        options:
          provider: ${consul.us}
      eu-usPeering:
        type: consul:Peering
        properties:
          peerName: eu-cluster
          peeringToken: ${consul_peering_token.token.peering_token}
          meta:
            hello: world
        options:
          provider: ${consul.eu}
    

    Create Peering Resource

    new Peering(name: string, args: PeeringArgs, opts?: CustomResourceOptions);
    @overload
    def Peering(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                meta: Optional[Mapping[str, str]] = None,
                partition: Optional[str] = None,
                peer_name: Optional[str] = None,
                peering_token: Optional[str] = None)
    @overload
    def Peering(resource_name: str,
                args: PeeringArgs,
                opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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:

    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.11.1 published on Friday, Jan 19, 2024 by Pulumi