GatewayAssociation

Associates a Direct Connect Gateway with a VGW or transit gateway.

To create a cross-account association, create an aws.directconnect.GatewayAssociationProposal resource in the AWS account that owns the VGW or transit gateway and then accept the proposal in the AWS account that owns the Direct Connect Gateway by creating an aws.directconnect.GatewayAssociation resource with the proposal_id and associated_gateway_owner_account_id attributes set.

Example Usage

VPN Gateway Association

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleGateway = new Aws.DirectConnect.Gateway("exampleGateway", new Aws.DirectConnect.GatewayArgs
        {
            AmazonSideAsn = "64512",
        });
        var exampleVpc = new Aws.Ec2.Vpc("exampleVpc", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.255.255.0/28",
        });
        var exampleVpnGateway = new Aws.Ec2.VpnGateway("exampleVpnGateway", new Aws.Ec2.VpnGatewayArgs
        {
            VpcId = exampleVpc.Id,
        });
        var exampleGatewayAssociation = new Aws.DirectConnect.GatewayAssociation("exampleGatewayAssociation", new Aws.DirectConnect.GatewayAssociationArgs
        {
            AssociatedGatewayId = exampleVpnGateway.Id,
            DxGatewayId = exampleGateway.Id,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/directconnect"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleGateway, err := directconnect.NewGateway(ctx, "exampleGateway", &directconnect.GatewayArgs{
            AmazonSideAsn: pulumi.String("64512"),
        })
        if err != nil {
            return err
        }
        exampleVpc, err := ec2.NewVpc(ctx, "exampleVpc", &ec2.VpcArgs{
            CidrBlock: pulumi.String("10.255.255.0/28"),
        })
        if err != nil {
            return err
        }
        exampleVpnGateway, err := ec2.NewVpnGateway(ctx, "exampleVpnGateway", &ec2.VpnGatewayArgs{
            VpcId: exampleVpc.ID(),
        })
        if err != nil {
            return err
        }
        _, err = directconnect.NewGatewayAssociation(ctx, "exampleGatewayAssociation", &directconnect.GatewayAssociationArgs{
            AssociatedGatewayId: exampleVpnGateway.ID(),
            DxGatewayId:         exampleGateway.ID(),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example_gateway = aws.directconnect.Gateway("exampleGateway", amazon_side_asn="64512")
example_vpc = aws.ec2.Vpc("exampleVpc", cidr_block="10.255.255.0/28")
example_vpn_gateway = aws.ec2.VpnGateway("exampleVpnGateway", vpc_id=example_vpc.id)
example_gateway_association = aws.directconnect.GatewayAssociation("exampleGatewayAssociation",
    associated_gateway_id=example_vpn_gateway.id,
    dx_gateway_id=example_gateway.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleGateway = new aws.directconnect.Gateway("example", {
    amazonSideAsn: "64512",
});
const exampleVpc = new aws.ec2.Vpc("example", {
    cidrBlock: "10.255.255.0/28",
});
const exampleVpnGateway = new aws.ec2.VpnGateway("example", {
    vpcId: exampleVpc.id,
});
const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
    associatedGatewayId: exampleVpnGateway.id,
    dxGatewayId: exampleGateway.id,
});

Transit Gateway Association

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleGateway = new Aws.DirectConnect.Gateway("exampleGateway", new Aws.DirectConnect.GatewayArgs
        {
            AmazonSideAsn = "64512",
        });
        var exampleTransitGateway = new Aws.Ec2TransitGateway.TransitGateway("exampleTransitGateway", new Aws.Ec2TransitGateway.TransitGatewayArgs
        {
        });
        var exampleGatewayAssociation = new Aws.DirectConnect.GatewayAssociation("exampleGatewayAssociation", new Aws.DirectConnect.GatewayAssociationArgs
        {
            AllowedPrefixes = 
            {
                "10.255.255.0/30",
                "10.255.255.8/30",
            },
            AssociatedGatewayId = exampleTransitGateway.Id,
            DxGatewayId = exampleGateway.Id,
        });
    }

}
package main

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

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleGateway, err := directconnect.NewGateway(ctx, "exampleGateway", &directconnect.GatewayArgs{
            AmazonSideAsn: pulumi.String("64512"),
        })
        if err != nil {
            return err
        }
        exampleTransitGateway, err := ec2transitgateway.NewTransitGateway(ctx, "exampleTransitGateway", nil)
        if err != nil {
            return err
        }
        _, err = directconnect.NewGatewayAssociation(ctx, "exampleGatewayAssociation", &directconnect.GatewayAssociationArgs{
            AllowedPrefixes: pulumi.StringArray{
                pulumi.String("10.255.255.0/30"),
                pulumi.String("10.255.255.8/30"),
            },
            AssociatedGatewayId: exampleTransitGateway.ID(),
            DxGatewayId:         exampleGateway.ID(),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example_gateway = aws.directconnect.Gateway("exampleGateway", amazon_side_asn="64512")
example_transit_gateway = aws.ec2transitgateway.TransitGateway("exampleTransitGateway")
example_gateway_association = aws.directconnect.GatewayAssociation("exampleGatewayAssociation",
    allowed_prefixes=[
        "10.255.255.0/30",
        "10.255.255.8/30",
    ],
    associated_gateway_id=example_transit_gateway.id,
    dx_gateway_id=example_gateway.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleGateway = new aws.directconnect.Gateway("example", {
    amazonSideAsn: "64512",
});
const exampleTransitGateway = new aws.ec2transitgateway.TransitGateway("example", {});
const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
    allowedPrefixes: [
        "10.255.255.0/30",
        "10.255.255.8/30",
    ],
    associatedGatewayId: exampleTransitGateway.id,
    dxGatewayId: exampleGateway.id,
});

Allowed Prefixes

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleGateway = new Aws.DirectConnect.Gateway("exampleGateway", new Aws.DirectConnect.GatewayArgs
        {
            AmazonSideAsn = "64512",
        });
        var exampleVpc = new Aws.Ec2.Vpc("exampleVpc", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.255.255.0/28",
        });
        var exampleVpnGateway = new Aws.Ec2.VpnGateway("exampleVpnGateway", new Aws.Ec2.VpnGatewayArgs
        {
            VpcId = exampleVpc.Id,
        });
        var exampleGatewayAssociation = new Aws.DirectConnect.GatewayAssociation("exampleGatewayAssociation", new Aws.DirectConnect.GatewayAssociationArgs
        {
            AllowedPrefixes = 
            {
                "210.52.109.0/24",
                "175.45.176.0/22",
            },
            AssociatedGatewayId = exampleVpnGateway.Id,
            DxGatewayId = exampleGateway.Id,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/directconnect"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleGateway, err := directconnect.NewGateway(ctx, "exampleGateway", &directconnect.GatewayArgs{
            AmazonSideAsn: pulumi.String("64512"),
        })
        if err != nil {
            return err
        }
        exampleVpc, err := ec2.NewVpc(ctx, "exampleVpc", &ec2.VpcArgs{
            CidrBlock: pulumi.String("10.255.255.0/28"),
        })
        if err != nil {
            return err
        }
        exampleVpnGateway, err := ec2.NewVpnGateway(ctx, "exampleVpnGateway", &ec2.VpnGatewayArgs{
            VpcId: exampleVpc.ID(),
        })
        if err != nil {
            return err
        }
        _, err = directconnect.NewGatewayAssociation(ctx, "exampleGatewayAssociation", &directconnect.GatewayAssociationArgs{
            AllowedPrefixes: pulumi.StringArray{
                pulumi.String("210.52.109.0/24"),
                pulumi.String("175.45.176.0/22"),
            },
            AssociatedGatewayId: exampleVpnGateway.ID(),
            DxGatewayId:         exampleGateway.ID(),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

example_gateway = aws.directconnect.Gateway("exampleGateway", amazon_side_asn="64512")
example_vpc = aws.ec2.Vpc("exampleVpc", cidr_block="10.255.255.0/28")
example_vpn_gateway = aws.ec2.VpnGateway("exampleVpnGateway", vpc_id=example_vpc.id)
example_gateway_association = aws.directconnect.GatewayAssociation("exampleGatewayAssociation",
    allowed_prefixes=[
        "210.52.109.0/24",
        "175.45.176.0/22",
    ],
    associated_gateway_id=example_vpn_gateway.id,
    dx_gateway_id=example_gateway.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleGateway = new aws.directconnect.Gateway("example", {
    amazonSideAsn: "64512",
});
const exampleVpc = new aws.ec2.Vpc("example", {
    cidrBlock: "10.255.255.0/28",
});
const exampleVpnGateway = new aws.ec2.VpnGateway("example", {
    vpcId: exampleVpc.id,
});
const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
    allowedPrefixes: [
        "210.52.109.0/24",
        "175.45.176.0/22",
    ],
    associatedGatewayId: exampleVpnGateway.id,
    dxGatewayId: exampleGateway.id,
});

Create a GatewayAssociation Resource

def GatewayAssociation(resource_name, opts=None, allowed_prefixes=None, associated_gateway_id=None, associated_gateway_owner_account_id=None, dx_gateway_id=None, proposal_id=None, vpn_gateway_id=None, __props__=None);
name string
The unique name of the resource.
args GatewayAssociationArgs
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 GatewayAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args GatewayAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

GatewayAssociation Resource Properties

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

Inputs

The GatewayAssociation resource accepts the following input properties:

DxGatewayId string

The ID of the Direct Connect gateway.

AllowedPrefixes List<string>

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

AssociatedGatewayId string

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

AssociatedGatewayOwnerAccountId string

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

ProposalId string

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

VpnGatewayId string

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

DxGatewayId string

The ID of the Direct Connect gateway.

AllowedPrefixes []string

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

AssociatedGatewayId string

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

AssociatedGatewayOwnerAccountId string

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

ProposalId string

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

VpnGatewayId string

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

dxGatewayId string

The ID of the Direct Connect gateway.

allowedPrefixes string[]

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

associatedGatewayId string

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

associatedGatewayOwnerAccountId string

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

proposalId string

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

vpnGatewayId string

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

dx_gateway_id str

The ID of the Direct Connect gateway.

allowed_prefixes List[str]

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

associated_gateway_id str

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

associated_gateway_owner_account_id str

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

proposal_id str

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

vpn_gateway_id str

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

Outputs

All input properties are implicitly available as output properties. Additionally, the GatewayAssociation resource produces the following output properties:

AssociatedGatewayType string

The type of the associated gateway, transitGateway or virtualPrivateGateway.

DxGatewayAssociationId string

The ID of the Direct Connect gateway association.

DxGatewayOwnerAccountId string

The ID of the AWS account that owns the Direct Connect gateway.

Id string
The provider-assigned unique ID for this managed resource.
AssociatedGatewayType string

The type of the associated gateway, transitGateway or virtualPrivateGateway.

DxGatewayAssociationId string

The ID of the Direct Connect gateway association.

DxGatewayOwnerAccountId string

The ID of the AWS account that owns the Direct Connect gateway.

Id string
The provider-assigned unique ID for this managed resource.
associatedGatewayType string

The type of the associated gateway, transitGateway or virtualPrivateGateway.

dxGatewayAssociationId string

The ID of the Direct Connect gateway association.

dxGatewayOwnerAccountId string

The ID of the AWS account that owns the Direct Connect gateway.

id string
The provider-assigned unique ID for this managed resource.
associated_gateway_type str

The type of the associated gateway, transitGateway or virtualPrivateGateway.

dx_gateway_association_id str

The ID of the Direct Connect gateway association.

dx_gateway_owner_account_id str

The ID of the AWS account that owns the Direct Connect gateway.

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing GatewayAssociation Resource

Get an existing GatewayAssociation 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?: GatewayAssociationState, opts?: CustomResourceOptions): GatewayAssociation
static get(resource_name, id, opts=None, allowed_prefixes=None, associated_gateway_id=None, associated_gateway_owner_account_id=None, associated_gateway_type=None, dx_gateway_association_id=None, dx_gateway_id=None, dx_gateway_owner_account_id=None, proposal_id=None, vpn_gateway_id=None, __props__=None);
func GetGatewayAssociation(ctx *Context, name string, id IDInput, state *GatewayAssociationState, opts ...ResourceOption) (*GatewayAssociation, error)
public static GatewayAssociation Get(string name, Input<string> id, GatewayAssociationState? 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:

AllowedPrefixes List<string>

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

AssociatedGatewayId string

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

AssociatedGatewayOwnerAccountId string

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

AssociatedGatewayType string

The type of the associated gateway, transitGateway or virtualPrivateGateway.

DxGatewayAssociationId string

The ID of the Direct Connect gateway association.

DxGatewayId string

The ID of the Direct Connect gateway.

DxGatewayOwnerAccountId string

The ID of the AWS account that owns the Direct Connect gateway.

ProposalId string

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

VpnGatewayId string

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

AllowedPrefixes []string

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

AssociatedGatewayId string

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

AssociatedGatewayOwnerAccountId string

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

AssociatedGatewayType string

The type of the associated gateway, transitGateway or virtualPrivateGateway.

DxGatewayAssociationId string

The ID of the Direct Connect gateway association.

DxGatewayId string

The ID of the Direct Connect gateway.

DxGatewayOwnerAccountId string

The ID of the AWS account that owns the Direct Connect gateway.

ProposalId string

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

VpnGatewayId string

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

allowedPrefixes string[]

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

associatedGatewayId string

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

associatedGatewayOwnerAccountId string

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

associatedGatewayType string

The type of the associated gateway, transitGateway or virtualPrivateGateway.

dxGatewayAssociationId string

The ID of the Direct Connect gateway association.

dxGatewayId string

The ID of the Direct Connect gateway.

dxGatewayOwnerAccountId string

The ID of the AWS account that owns the Direct Connect gateway.

proposalId string

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

vpnGatewayId string

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

allowed_prefixes List[str]

VPC prefixes (CIDRs) to advertise to the Direct Connect gateway. Defaults to the CIDR block of the VPC associated with the Virtual Gateway. To enable drift detection, must be configured.

associated_gateway_id str

The ID of the VGW or transit gateway with which to associate the Direct Connect gateway. Used for single account Direct Connect gateway associations.

associated_gateway_owner_account_id str

The ID of the AWS account that owns the VGW or transit gateway with which to associate the Direct Connect gateway. Used for cross-account Direct Connect gateway associations.

associated_gateway_type str

The type of the associated gateway, transitGateway or virtualPrivateGateway.

dx_gateway_association_id str

The ID of the Direct Connect gateway association.

dx_gateway_id str

The ID of the Direct Connect gateway.

dx_gateway_owner_account_id str

The ID of the AWS account that owns the Direct Connect gateway.

proposal_id str

The ID of the Direct Connect gateway association proposal. Used for cross-account Direct Connect gateway associations.

vpn_gateway_id str

Deprecated: Use associated_gateway_id instead. The ID of the VGW with which to associate the gateway. Used for single account Direct Connect gateway associations.

Deprecated: use 'associated_gateway_id' argument instead

Package Details

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