Manages a Transit Gateway VPC Attachment between a VPC (with one or more subnet(s) to select) or a VPN and a Transit Gateway.
Call the module in directly from git or git clone in your working directory.
Terraform > v.0.12
data "aws_ec2_transit_gateway" "prod" {
id = "tgw-xxxxxxx"
}
data "aws_ec2_transit_gateway" "preprod" {
id = "tgw-yyyyyy"
}
data "aws_ec2_transit_gateway" "dev" {
id = "tgw-zzzzzz"
}
module "transit_gateway_attachment" {
source = "git::https://github.com/Ph4rell/Terraform-module-TGW-attachment.git"
subnet_ids = [
list of subnets ID (example: aws_subnet.subnet.id)
]
transit_gateway_id = var.transit_gateway_id
vpc_id = aws_vpc.vpc.id
dns_support = enable/disable
ipv6_support = enable/disable
vpc_name = var.vpc_name
contact = var.contact
tags = var.tags
}
It is possible to run a test in the test folder.
After a git clone of the project, go to test folder.
Put your test variables in the terraform.tfvars
.
vpc_name = "VPC-Test"
contact = "email@example.com"
tags = {
tag1 = "value1"
tag2 = "value2"
tag3 = "value3"
}
transit_gateway = "Prod"
terraform init
terraform plan
terraform apply
Check if the resources have been well created in the account. Don't forget to destroy the resources with terraform.
terraform destroy
Name | Description | Type | Default | Required |
---|---|---|---|---|
contact | n/a | string |
n/a | yes |
dns_support | (Optional) Whether DNS support is enabled. Valid values: disable, enable. Default value: enable | string |
"enable" |
no |
ipv6_support | (Optional) Whether IPv6 support is enabled. Valid values: disable, enable. Default value: disable | string |
"disable" |
no |
subnet_ids | (Required) Identifiers of Subnets (Example: subnet-xxxxxxxxxxxxxxxxx) | list(string) |
n/a | yes |
tags | A map of tags | map(string) |
n/a | yes |
transit_gateway | (Required) Select the environement of the Transit Gateway: Prod, Preprod or Dev | string |
n/a | yes |
transit_gateway_default_route_table_association | (Optional) Boolean whether the VPC Attachment should be associated with the Transit Gateway association default route table. Default value: false | string |
false |
no |
transit_gateway_default_route_table_propagation | (Optional) Boolean whether the VPC Attachment should propagate routes with the Transit Gateway propagation default route table. Default value: false | string |
false |
no |
vpc_id | (Required) Identifier of the VPC to attach | string |
n/a | yes |
vpc_name | (Required) Provide the logical name of the VPC that will be attached to the transit gateway,format VPC-Name | string |
"VPC-CLIENT" |
no |
Name | Description |
---|---|
attach_id | Transit Gateway VPC Attachment identifier |
dns_support | Whether DNS support is enabled |
ipv6_support | Whether IPv6 support is enabled |
subnet_ids | Identifiers of Subnets |
tags | Key-value tags for the Transit Gateway VPC Attachment |
transit_gateway_id | Transit Gateway identifier |
vpc_id | Identifier of the VPC |
vpc_owner_id | Identifier of the AWS account that owns the VPC |