Skip to content

Resource: awsEc2TransitGatewayVpcAttachmentAccepter

Manages the accepter's side of an EC2 Transit Gateway VPC Attachment.

When a cross-account (requester's AWS account differs from the accepter's AWS account) EC2 Transit Gateway VPC Attachment is created, an EC2 Transit Gateway VPC Attachment resource is automatically created in the accepter's account. The requester can use the awsEc2TransitGatewayVpcAttachment resource to manage its side of the connection and the accepter can use the awsEc2TransitGatewayVpcAttachmentAccepter resource to "adopt" its side of the connection into management.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.ec2TransitGatewayVpcAttachmentAccepter.Ec2TransitGatewayVpcAttachmentAccepter(
  this,
  "example",
  {
    tags: {
      Name: "Example cross-account attachment",
    },
    transitGatewayAttachmentId:
      "${aws_ec2_transit_gateway_vpc_attachment.example.id}",
  }
);

A full example of how to create a Transit Gateway in one AWS account, share it with a second AWS account, and attach a VPC in the second account to the Transit Gateway via the awsEc2TransitGatewayVpcAttachment and awsEc2TransitGatewayVpcAttachmentAccepter resources can be found in the /examples/transitGatewayCrossAccountVpcAttachment directory within the Github Repository.

Argument Reference

The following arguments are supported:

  • transitGatewayAttachmentId - (Required) The ID of the EC2 Transit Gateway Attachment to manage.
  • transitGatewayDefaultRouteTableAssociation - (Optional) Boolean whether the VPC Attachment should be associated with the EC2 Transit Gateway association default route table. Default value: true.
  • transitGatewayDefaultRouteTablePropagation - (Optional) Boolean whether the VPC Attachment should propagate routes with the EC2 Transit Gateway propagation default route table. Default value: true.
  • tags - (Optional) Key-value tags for the EC2 Transit Gateway VPC Attachment. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - EC2 Transit Gateway Attachment identifier
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
  • applianceModeSupport - Whether Appliance Mode support is enabled. Valid values: disable, enable.
  • dnsSupport - Whether DNS support is enabled. Valid values: disable, enable.
  • ipv6Support - Whether IPv6 support is enabled. Valid values: disable, enable.
  • subnetIds - Identifiers of EC2 Subnets.
  • transitGatewayId - Identifier of EC2 Transit Gateway.
  • vpcId - Identifier of EC2 VPC.
  • vpcOwnerId - Identifier of the AWS account that owns the EC2 VPC.

Import

awsEc2TransitGatewayVpcAttachmentAccepter can be imported by using the EC2 Transit Gateway Attachment identifier, e.g.,

$ terraform import aws_ec2_transit_gateway_vpc_attachment_accepter.example tgw-attach-12345678