1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# 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 = {}
}
|