# Variables ==================================================================== variable "transit_gateway_id" { description = "ID of the Transit Gateway to attach to" type = string validation { condition = can(regex("^tgw-[a-f0-9]+$", var.transit_gateway_id)) error_message = "transit_gateway_id must be a valid TGW ID format e.g. tgw-0b330520fe6cc7758." } } variable "vpc_id" { description = "ID of the VPC to attach" type = string validation { condition = can(regex("^vpc-[a-f0-9]+$", var.vpc_id)) error_message = "vpc_id must be a valid VPC ID format e.g. vpc-0a1b2c3d4e5f." } } variable "subnet_ids" { description = "List of subnet IDs (one per AZ) for the TGW attachment ENIs" type = list(string) validation { condition = length(var.subnet_ids) > 0 && alltrue([for id in var.subnet_ids : can(regex("^subnet-[a-f0-9]+$", id))]) error_message = "subnet_ids must be a non-empty list of valid subnet ID formats e.g. subnet-0a1b2c3d4e5f." } } variable "name" { description = "Name for the TGW attachment" type = string validation { condition = length(var.name) > 0 error_message = "name must not be empty." } } variable "appliance_mode_support" { description = "Enable appliance mode (required for stateful appliances)" type = string default = "disable" validation { condition = contains(["enable", "disable"], var.appliance_mode_support) error_message = "appliance_mode_support must be enable or disable." } } variable "dns_support" { description = "DNS support for the attachment" type = string default = "enable" validation { condition = contains(["enable", "disable"], var.dns_support) error_message = "dns_support must be enable or disable." } } variable "ipv6_support" { description = "IPv6 support for the attachment" type = string default = "disable" validation { condition = contains(["enable", "disable"], var.ipv6_support) error_message = "ipv6_support must be enable or disable." } } variable "transit_gateway_route_table_id" { description = "TGW route table ID to associate and propagate. Uses TGW default route table when null." type = string default = null } variable "vpc_route_table_ids" { description = "VPC route table IDs to add TGW routes to" type = list(string) default = [] validation { condition = alltrue([for id in var.vpc_route_table_ids : can(regex("^rtb-[a-f0-9]+$", id))]) error_message = "All vpc_route_table_ids must be valid route table ID formats e.g. rtb-0a1b2c3d4e5f." } } variable "vpc_tgw_routes" { description = "Map of CIDR destinations to add as TGW routes in vpc_route_table_ids" type = map(string) default = { "0.0.0.0/0" = "tgw" } validation { condition = alltrue([for cidr, _ in var.vpc_tgw_routes : can(cidrhost(cidr, 0))]) error_message = "All keys in vpc_tgw_routes must be valid CIDR notation." } } variable "tags" { description = "Resource tags to apply to all resources" type = map(string) default = {} }