# transit-gateway

Creates an AWS Transit Gateway in the network account with RAM-based cross-account sharing.

Provisions a TGW with configurable BGP ASN, route table association/propagation, DNS support, and ECMP for VPN. Creates additional custom route tables beyond the default, and shares the TGW to spoke accounts or OUs via AWS Resource Access Manager. Spoke accounts attach via the `networking/tgw-attachment` module.

## Usage

```hcl
module "tgw" {
  source  = "hcassc.jfrog.io/iac-terraform-modules-virtual/networking/transit-gateway/aws"
  version = "0.1.0"

  name           = "core-tgw"
  ram_share_name = "tgw-share"
  ram_principals = ["arn:aws:organizations::111122223333:organization/o-xxxx"]
}
```

<!-- BEGIN_TF_DOCS — DO NOT EDIT BELOW THIS LINE -->
## Requirements

| Name | Version |
| ---- | ------- |
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | ~> 1.5 |
| <a name="requirement_aws"></a> [aws](#requirement_aws) | ~> 6.50 |

## Providers

| Name | Version |
| ---- | ------- |
| <a name="provider_aws"></a> [aws](#provider_aws) | 6.50.0 |

## 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_route_table.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_route_table) | resource |
| [aws_ram_principal_association.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_principal_association) | resource |
| [aws_ram_resource_association.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_resource_association) | resource |
| [aws_ram_resource_share.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ram_resource_share) | resource |

## Inputs

| Name | Description | Type | Default | Required |
| ---- | ----------- | ---- | ------- | :------: |
| <a name="input_name"></a> [name](#input_name) | Name for the Transit Gateway | `string` | n/a | yes |
| <a name="input_amazon_side_asn"></a> [amazon_side_asn](#input_amazon_side_asn) | BGP ASN for the Amazon side (64512–65534, or 4200000000–4294967294) | `number` | `64512` | no |
| <a name="input_auto_accept_shared_attachments"></a> [auto_accept_shared_attachments](#input_auto_accept_shared_attachments) | Auto-accept cross-account VPC attachments | `string` | `"disable"` | no |
| <a name="input_default_route_table_association"></a> [default_route_table_association](#input_default_route_table_association) | Associate attachments with the default route table | `string` | `"enable"` | no |
| <a name="input_default_route_table_propagation"></a> [default_route_table_propagation](#input_default_route_table_propagation) | Propagate routes to the default route table | `string` | `"enable"` | no |
| <a name="input_description"></a> [description](#input_description) | Description of the Transit Gateway | `string` | `""` | no |
| <a name="input_dns_support"></a> [dns_support](#input_dns_support) | DNS support across VPC attachments | `string` | `"enable"` | no |
| <a name="input_ram_principals"></a> [ram_principals](#input_ram_principals) | List of AWS account IDs or org ARNs to share the TGW with via RAM | `list(string)` | `[]` | no |
| <a name="input_ram_share_name"></a> [ram_share_name](#input_ram_share_name) | Name for the RAM resource share (null to skip sharing) | `string` | `null` | no |
| <a name="input_route_tables"></a> [route_tables](#input_route_tables) | Map of additional TGW route tables to create (beyond the default) | <pre>map(object({<br/>    name = string<br/>  }))</pre> | `{}` | no |
| <a name="input_tags"></a> [tags](#input_tags) | Resource tags to apply to all resources | `map(string)` | `{}` | no |
| <a name="input_vpn_ecmp_support"></a> [vpn_ecmp_support](#input_vpn_ecmp_support) | ECMP routing for VPN attachments | `string` | `"enable"` | no |

## Outputs

| Name | Description |
| ---- | ----------- |
| <a name="output_arn"></a> [arn](#output_arn) | Transit Gateway ARN |
| <a name="output_default_route_table_id"></a> [default_route_table_id](#output_default_route_table_id) | Default TGW route table ID |
| <a name="output_id"></a> [id](#output_id) | Transit Gateway ID |
| <a name="output_ram_share_arn"></a> [ram_share_arn](#output_ram_share_arn) | RAM resource share ARN (null if sharing not configured) |
| <a name="output_route_table_ids"></a> [route_table_ids](#output_route_table_ids) | Map of additional route table logical key to ID |
<!-- END_TF_DOCS — DO NOT EDIT ABOVE THIS LINE -->
