Skip to content

Resource: awsEc2TransitGatewayVpcAttachment

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

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.ec2TransitGatewayVpcAttachment.Ec2TransitGatewayVpcAttachment(
  this,
  "example",
  {
    subnetIds: ["${aws_subnet.example.id}"],
    transitGatewayId: "${aws_ec2_transit_gateway.example.id}",
    vpcId: "${aws_vpc.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:

  • subnetIds - (Required) Identifiers of EC2 Subnets.
  • transitGatewayId - (Required) Identifier of EC2 Transit Gateway.
  • vpcId - (Required) Identifier of EC2 VPC.
  • applianceModeSupport - (Optional) Whether Appliance Mode support is enabled. If enabled, a traffic flow between a source and destination uses the same Availability Zone for the VPC attachment for the lifetime of that flow. Valid values: disable, enable. Default value: disable.
  • dnsSupport - (Optional) Whether DNS support is enabled. Valid values: disable, enable. Default value: enable.
  • ipv6Support - (Optional) Whether IPv6 support is enabled. Valid values: disable, enable. Default value: disable.
  • 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.
  • transitGatewayDefaultRouteTableAssociation - (Optional) Boolean whether the VPC Attachment should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: true.
  • transitGatewayDefaultRouteTablePropagation - (Optional) Boolean whether the VPC Attachment should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: true.

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.
  • vpcOwnerId - Identifier of the AWS account that owns the EC2 VPC.

Import

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

$ terraform import aws_ec2_transit_gateway_vpc_attachment.example tgw-attach-12345678