https://github.com/sourcefuse/terraform-aws-arc-transit-gateway
Terraform Module for Transit Gateway
https://github.com/sourcefuse/terraform-aws-arc-transit-gateway
Last synced: 4 months ago
JSON representation
Terraform Module for Transit Gateway
- Host: GitHub
- URL: https://github.com/sourcefuse/terraform-aws-arc-transit-gateway
- Owner: sourcefuse
- License: apache-2.0
- Created: 2024-08-01T12:03:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-30T05:21:52.000Z (almost 2 years ago)
- Last Synced: 2025-08-01T05:55:59.154Z (11 months ago)
- Language: HCL
- Homepage:
- Size: 4.16 MB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README

# [terraform-aws-arc-transit-gateway](https://github.com/sourcefuse/terraform-aws-arc-transit-gateway)
 
[](https://sonarcloud.io/summary/new_code?id=sourcefuse_terraform-aws-arc-transit-gateway)
[](https://github.com/sourcefuse/terraform-aws-arc-transit-gateway/actions/workflows/snyk.yaml)
## Overview
SourceFuse AWS Reference Architecture (ARC) Terraform module for managing Transit Gateway Terraform module provides a robust solution for managing complex network architectures within AWS. This module simplifies the creation, configuration, and management of AWS Transit Gateway, VPC attachments, and routing between VPCs. It ensures efficient network integration and connectivity across multiple AWS accounts by leveraging AWS best practices and conditional resource creation, making it ideal for scalable and flexible network solutions.
## Usage
To see a full example, check out the [main.tf](./example/main.tf) file in the example folder.
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | ~> 1.3, < 2.0.0 |
| [aws](#requirement\_aws) | ~> 5.0 |
| [random](#requirement\_random) | ~> 3.0 |
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 5.64.0 |
| [aws.target](#provider\_aws.target) | 5.64.0 |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_ec2_transit_gateway.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway) | resource |
| [aws_ec2_transit_gateway_vpc_attachment.source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) | resource |
| [aws_ec2_transit_gateway_vpc_attachment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) | resource |
| [aws_ec2_transit_gateway_vpc_attachment_accepter.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment_accepter) | resource |
| [aws_ram_principal_association.target_account](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_principal_association) | resource |
| [aws_ram_resource_association.transit_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_resource_association) | resource |
| [aws_ram_resource_share.transit_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_resource_share) | resource |
| [aws_ram_resource_share_accepter.transit_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_resource_share_accepter) | resource |
| [aws_route.source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |
| [aws_route.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |
| [aws_ec2_transit_gateway.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ec2_transit_gateway) | data source |
| [aws_vpc.source_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
| [aws_vpc.target_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [allow\_external\_principals](#input\_allow\_external\_principals) | Indicates whether external principals (accounts outside the organization) are allowed. | `bool` | `true` | no |
| [auto\_accept\_shared\_attachments](#input\_auto\_accept\_shared\_attachments) | Whether resource attachment requests are automatically accepted | `string` | `"disable"` | no |
| [create\_transit\_gateway](#input\_create\_transit\_gateway) | n/a | `bool` | `true` | no |
| [create\_transit\_gateway\_attacment\_in\_source\_account](#input\_create\_transit\_gateway\_attacment\_in\_source\_account) | n/a | `bool` | `true` | no |
| [default\_route\_table\_association](#input\_default\_route\_table\_association) | Whether resource attachments are associated with the default route table | `string` | `"enable"` | no |
| [default\_route\_table\_propagation](#input\_default\_route\_table\_propagation) | Whether resource attachments automatically propagate routes to the default route table | `string` | `"enable"` | no |
| [dns\_support](#input\_dns\_support) | Enable or disable DNS support | `string` | `"enable"` | no |
| [existing\_transit\_gateway\_id](#input\_existing\_transit\_gateway\_id) | n/a | `string` | `null` | no |
| [source\_attachment\_dns\_support](#input\_source\_attachment\_dns\_support) | Enable or disable DNS support | `string` | `"enable"` | no |
| [source\_attachment\_ipv6\_support](#input\_source\_attachment\_ipv6\_support) | Enable or disable IPv6 support | `string` | `"disable"` | no |
| [source\_attachment\_name](#input\_source\_attachment\_name) | The name tag for the source Transit Gateway VPC attachment. | `string` | `"TransitGateway-VPC-Attachment-Source"` | no |
| [source\_cidr\_block](#input\_source\_cidr\_block) | Destination CIDR block for the route | `string` | `null` | no |
| [source\_route\_table\_ids](#input\_source\_route\_table\_ids) | Route table ID to add routes to | `list(any)` | `[]` | no |
| [source\_subnet\_ids](#input\_source\_subnet\_ids) | List of subnet IDs for the Transit Gateway VPC attachment | `list(string)` | `[]` | no |
| [source\_vpc\_id](#input\_source\_vpc\_id) | The VPC ID for the Transit Gateway VPC attachment | `string` | `null` | no |
| [tags](#input\_tags) | A map of tags to assign to the resource. | `map(string)` | `{}` | no |
| [target\_account\_id](#input\_target\_account\_id) | The AWS Account ID where the Transit Gateway is shared | `list(any)` | n/a | yes |
| [target\_attachment\_dns\_support](#input\_target\_attachment\_dns\_support) | Enable or disable DNS support | `string` | `"enable"` | no |
| [target\_attachment\_ipv6\_support](#input\_target\_attachment\_ipv6\_support) | Enable or disable IPv6 support | `string` | `"disable"` | no |
| [target\_attachment\_name](#input\_target\_attachment\_name) | The name tag for the target Transit Gateway VPC attachment. | `string` | `"TransitGateway-VPC-Attachment-Target"` | no |
| [target\_cidr\_block](#input\_target\_cidr\_block) | Destination CIDR block for the route | `string` | `null` | no |
| [target\_route\_table\_ids](#input\_target\_route\_table\_ids) | Route table ID to add routes to | `list(any)` | n/a | yes |
| [target\_subnet\_ids](#input\_target\_subnet\_ids) | List of subnet IDs for the Transit Gateway VPC attachment | `list(string)` | n/a | yes |
| [target\_vpc\_id](#input\_target\_vpc\_id) | The VPC ID for the Transit Gateway VPC attachment | `string` | n/a | yes |
| [transit\_gateway\_asn](#input\_transit\_gateway\_asn) | Amazon side ASN for the Transit Gateway | `number` | `64512` | no |
| [transit\_gateway\_name](#input\_transit\_gateway\_name) | Name of the Transit Gateway | `string` | `"Transit-GW"` | no |
| [transit\_gateway\_share\_name](#input\_transit\_gateway\_share\_name) | The name of the Transit Gateway resource share. | `string` | `"transit-gateway-share"` | no |
| [vpn\_ecmp\_support](#input\_vpn\_ecmp\_support) | Enable or disable Equal Cost Multipath support for VPN | `string` | `"enable"` | no |
## Outputs
| Name | Description |
|------|-------------|
| [transit\_gateway\_arn](#output\_transit\_gateway\_arn) | The ARN of the Transit Gateway |
| [transit\_gateway\_id](#output\_transit\_gateway\_id) | The ID of the Transit Gateway |
## Versioning
This project uses a `.version` file at the root of the repo which the pipeline reads from and does a git tag.
When you intend to commit to `main`, you will need to increment this version. Once the project is merged,
the pipeline will kick off and tag the latest git commit.
## Development
### Prerequisites
- [terraform](https://learn.hashicorp.com/terraform/getting-started/install#installing-terraform)
- [terraform-docs](https://github.com/segmentio/terraform-docs)
- [pre-commit](https://pre-commit.com/#install)
- [golang](https://golang.org/doc/install#install)
- [golint](https://github.com/golang/lint#installation)
### Configurations
- Configure pre-commit hooks
```sh
pre-commit install
```
### Versioning
while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch
For Example
```sh
git commit -m "your commit message #major"
```
By specifying this , it will bump the version and if you don't specify this in your commit message then by default it will consider patch and will bump that accordingly
### Tests
- Tests are available in `test` directory
- Configure the dependencies
```sh
cd test/
go mod init github.com/sourcefuse/terraform-aws-refarch-
go get github.com/gruntwork-io/terratest/modules/terraform
```
- Now execute the test
```sh
go test -timeout 30m
```
## Authors
This project is authored by:
- SourceFuse ARC Team