PeeringAttachment

Manages an EC2 Transit Gateway Peering Attachment. For examples of custom route table association and propagation, see the EC2 Transit Gateway Networking Examples Guide.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var local = new Aws.Provider("local", new Aws.ProviderArgs
        {
            Region = "us-east-1",
        });
        var peer = new Aws.Provider("peer", new Aws.ProviderArgs
        {
            Region = "us-west-2",
        });
        var peerRegion = Output.Create(Aws.GetRegion.InvokeAsync());
        var localTransitGateway = new Aws.Ec2TransitGateway.TransitGateway("localTransitGateway", new Aws.Ec2TransitGateway.TransitGatewayArgs
        {
            Tags = 
            {
                { "Name", "Local TGW" },
            },
        }, new CustomResourceOptions
        {
            Provider = aws.Local,
        });
        var peerTransitGateway = new Aws.Ec2TransitGateway.TransitGateway("peerTransitGateway", new Aws.Ec2TransitGateway.TransitGatewayArgs
        {
            Tags = 
            {
                { "Name", "Peer TGW" },
            },
        }, new CustomResourceOptions
        {
            Provider = aws.Peer,
        });
        var example = new Aws.Ec2TransitGateway.PeeringAttachment("example", new Aws.Ec2TransitGateway.PeeringAttachmentArgs
        {
            PeerAccountId = peerTransitGateway.OwnerId,
            PeerRegion = peerRegion.Apply(peerRegion => peerRegion.Name),
            PeerTransitGatewayId = peerTransitGateway.Id,
            TransitGatewayId = localTransitGateway.Id,
            Tags = 
            {
                { "Name", "TGW Peering Requestor" },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2transitgateway"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/providers"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := providers.Newaws(ctx, "local", &providers.awsArgs{
            Region: pulumi.String("us-east-1"),
        })
        if err != nil {
            return err
        }
        _, err = providers.Newaws(ctx, "peer", &providers.awsArgs{
            Region: pulumi.String("us-west-2"),
        })
        if err != nil {
            return err
        }
        peerRegion, err := aws.GetRegion(ctx, nil, nil)
        if err != nil {
            return err
        }
        localTransitGateway, err := ec2transitgateway.NewTransitGateway(ctx, "localTransitGateway", &ec2transitgateway.TransitGatewayArgs{
            Tags: pulumi.StringMap{
                "Name": pulumi.String("Local TGW"),
            },
        }, pulumi.Provider(aws.Local))
        if err != nil {
            return err
        }
        peerTransitGateway, err := ec2transitgateway.NewTransitGateway(ctx, "peerTransitGateway", &ec2transitgateway.TransitGatewayArgs{
            Tags: pulumi.StringMap{
                "Name": pulumi.String("Peer TGW"),
            },
        }, pulumi.Provider(aws.Peer))
        if err != nil {
            return err
        }
        _, err = ec2transitgateway.NewPeeringAttachment(ctx, "example", &ec2transitgateway.PeeringAttachmentArgs{
            PeerAccountId:        peerTransitGateway.OwnerId,
            PeerRegion:           pulumi.String(peerRegion.Name),
            PeerTransitGatewayId: peerTransitGateway.ID(),
            TransitGatewayId:     localTransitGateway.ID(),
            Tags: pulumi.StringMap{
                "Name": pulumi.String("TGW Peering Requestor"),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws
import pulumi_pulumi as pulumi

local = pulumi.providers.Aws("local", region="us-east-1")
peer = pulumi.providers.Aws("peer", region="us-west-2")
peer_region = aws.get_region()
local_transit_gateway = aws.ec2transitgateway.TransitGateway("localTransitGateway", tags={
    "Name": "Local TGW",
},
opts=ResourceOptions(provider=aws["local"]))
peer_transit_gateway = aws.ec2transitgateway.TransitGateway("peerTransitGateway", tags={
    "Name": "Peer TGW",
},
opts=ResourceOptions(provider=aws["peer"]))
example = aws.ec2transitgateway.PeeringAttachment("example",
    peer_account_id=peer_transit_gateway.owner_id,
    peer_region=peer_region.name,
    peer_transit_gateway_id=peer_transit_gateway.id,
    transit_gateway_id=local_transit_gateway.id,
    tags={
        "Name": "TGW Peering Requestor",
    })
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const local = new aws.Provider("local", {region: "us-east-1"});
const peer = new aws.Provider("peer", {region: "us-west-2"});
const peerRegion = aws.getRegion({});
const localTransitGateway = new aws.ec2transitgateway.TransitGateway("localTransitGateway", {tags: {
    Name: "Local TGW",
}}, {
    provider: aws.local,
});
const peerTransitGateway = new aws.ec2transitgateway.TransitGateway("peerTransitGateway", {tags: {
    Name: "Peer TGW",
}}, {
    provider: aws.peer,
});
const example = new aws.ec2transitgateway.PeeringAttachment("example", {
    peerAccountId: peerTransitGateway.ownerId,
    peerRegion: peerRegion.then(peerRegion => peerRegion.name),
    peerTransitGatewayId: peerTransitGateway.id,
    transitGatewayId: localTransitGateway.id,
    tags: {
        Name: "TGW Peering Requestor",
    },
});

Create a PeeringAttachment Resource

def PeeringAttachment(resource_name, opts=None, peer_account_id=None, peer_region=None, peer_transit_gateway_id=None, tags=None, transit_gateway_id=None, __props__=None);
name string
The unique name of the resource.
args PeeringAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args PeeringAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PeeringAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

PeeringAttachment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The PeeringAttachment resource accepts the following input properties:

PeerRegion string

Region of EC2 Transit Gateway to peer with.

PeerTransitGatewayId string

Identifier of EC2 Transit Gateway to peer with.

TransitGatewayId string

Identifier of EC2 Transit Gateway.

PeerAccountId string

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

Tags Dictionary<string, string>

Key-value tags for the EC2 Transit Gateway Peering Attachment.

PeerRegion string

Region of EC2 Transit Gateway to peer with.

PeerTransitGatewayId string

Identifier of EC2 Transit Gateway to peer with.

TransitGatewayId string

Identifier of EC2 Transit Gateway.

PeerAccountId string

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

Tags map[string]string

Key-value tags for the EC2 Transit Gateway Peering Attachment.

peerRegion string

Region of EC2 Transit Gateway to peer with.

peerTransitGatewayId string

Identifier of EC2 Transit Gateway to peer with.

transitGatewayId string

Identifier of EC2 Transit Gateway.

peerAccountId string

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

tags {[key: string]: string}

Key-value tags for the EC2 Transit Gateway Peering Attachment.

peer_region str

Region of EC2 Transit Gateway to peer with.

peer_transit_gateway_id str

Identifier of EC2 Transit Gateway to peer with.

transit_gateway_id str

Identifier of EC2 Transit Gateway.

peer_account_id str

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

tags Dict[str, str]

Key-value tags for the EC2 Transit Gateway Peering Attachment.

Outputs

All input properties are implicitly available as output properties. Additionally, the PeeringAttachment 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing PeeringAttachment Resource

Get an existing PeeringAttachment 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?: PeeringAttachmentState, opts?: CustomResourceOptions): PeeringAttachment
static get(resource_name, id, opts=None, peer_account_id=None, peer_region=None, peer_transit_gateway_id=None, tags=None, transit_gateway_id=None, __props__=None);
func GetPeeringAttachment(ctx *Context, name string, id IDInput, state *PeeringAttachmentState, opts ...ResourceOption) (*PeeringAttachment, error)
public static PeeringAttachment Get(string name, Input<string> id, PeeringAttachmentState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

PeerAccountId string

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

PeerRegion string

Region of EC2 Transit Gateway to peer with.

PeerTransitGatewayId string

Identifier of EC2 Transit Gateway to peer with.

Tags Dictionary<string, string>

Key-value tags for the EC2 Transit Gateway Peering Attachment.

TransitGatewayId string

Identifier of EC2 Transit Gateway.

PeerAccountId string

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

PeerRegion string

Region of EC2 Transit Gateway to peer with.

PeerTransitGatewayId string

Identifier of EC2 Transit Gateway to peer with.

Tags map[string]string

Key-value tags for the EC2 Transit Gateway Peering Attachment.

TransitGatewayId string

Identifier of EC2 Transit Gateway.

peerAccountId string

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

peerRegion string

Region of EC2 Transit Gateway to peer with.

peerTransitGatewayId string

Identifier of EC2 Transit Gateway to peer with.

tags {[key: string]: string}

Key-value tags for the EC2 Transit Gateway Peering Attachment.

transitGatewayId string

Identifier of EC2 Transit Gateway.

peer_account_id str

Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the current provider is currently connected to.

peer_region str

Region of EC2 Transit Gateway to peer with.

peer_transit_gateway_id str

Identifier of EC2 Transit Gateway to peer with.

tags Dict[str, str]

Key-value tags for the EC2 Transit Gateway Peering Attachment.

transit_gateway_id str

Identifier of EC2 Transit Gateway.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.