Resource: aws_ec2_transit_gateway_vpc_attachment_accepter

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 aws_ec2_transit_gateway_vpc_attachment resource to manage its side of the connection and the accepter can use the aws_ec2_transit_gateway_vpc_attachment_accepter resource to "adopt" its side of the connection into management.

Example Usage

resource "aws_ec2_transit_gateway_vpc_attachment_accepter" "example" {
  transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id

  tags = {
    Name = "Example cross-account attachment"
  }
}

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 aws_ec2_transit_gateway_vpc_attachment and aws_ec2_transit_gateway_vpc_attachment_accepter resources can be found in the ./examples/transit-gateway-cross-account-vpc-attachment directory within the Github Repository.

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_ec2_transit_gateway_vpc_attachment_accepter using the EC2 Transit Gateway Attachment identifier. For example:

import {
  to = aws_ec2_transit_gateway_vpc_attachment_accepter.example
  id = "tgw-attach-12345678"
}

Using terraform import, import aws_ec2_transit_gateway_vpc_attachment_accepter using the EC2 Transit Gateway Attachment identifier. For example:

% terraform import aws_ec2_transit_gateway_vpc_attachment_accepter.example tgw-attach-12345678