-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
248 lines (208 loc) · 6.48 KB
/
variables.tf
File metadata and controls
248 lines (208 loc) · 6.48 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// variables.tf
variable "project_name" {
description = "Name of the project"
type = string
default = "demo-app"
}
variable "environment" {
description = "Environment (e.g., prod, dev, test)"
type = string
default = "test"
}
variable "name_prefix" {
description = "Prefix for resource names (if not provided, will use project-environment pattern)"
type = string
default = ""
}
variable "tags" {
description = "Additional tags for all resources"
type = map(string)
default = {}
}
variable "vpc_id" {
description = "VPC ID where the ALB will be created"
type = string
}
variable "subnet_ids" {
description = "List of subnet IDs for the ALB"
type = list(string)
}
variable "security_group_ids" {
description = "List of security group IDs for the ALB"
type = list(string)
}
variable "certificate_arn" {
description = "ARN of the SSL certificate for HTTPS listener (required)"
type = string
}
variable "waf_web_acl_arn" {
description = "ARN of the WAF Web ACL to associate with the ALB"
type = string
default = ""
}
variable "enable_access_logs" {
description = "Enable access logs for the ALB"
type = bool
default = true # Best practice: enable logging by default
}
variable "create_logs_bucket" {
description = "Create S3 bucket for ALB access logs"
type = bool
default = true # Secure-by-default: create bucket if logging enabled
}
variable "access_logs_bucket" {
description = "S3 bucket name for ALB access logs (required if enable_access_logs=true and create_logs_bucket=false)"
type = string
default = ""
}
variable "access_logs_prefix" {
description = "S3 prefix for ALB access logs"
type = string
default = "alb-access-logs"
}
variable "s3_kms_key_arn" {
description = "ARN of the KMS key for S3 bucket encryption (if empty, uses S3 managed keys)"
type = string
default = ""
}
variable "aws_region" {
description = "AWS region where resources will be created"
type = string
}
variable "s3_server_side_encryption_algorithm" {
description = "Server-side encryption algorithm for S3 bucket"
type = string
default = "AES256"
}
variable "alb_logs_s3_policy_principal" {
description = "IAM principal for S3 bucket policy (default is ELB service account)"
type = string
default = ""
}
variable "access_logs_enabled" {
description = "Enable access logs for the ALB"
type = bool
default = true
}
variable "health_check_enabled" {
description = "Enable health checks for target groups"
type = bool
default = true
}
variable "internal" {
description = "Whether the ALB should be internal"
type = bool
default = false
}
variable "idle_timeout" {
description = "The time in seconds that the connection is allowed to be idle"
type = number
default = 60
}
variable "enable_deletion_protection" {
description = "Whether to enable deletion protection"
type = bool
default = true
}
variable "enable_cross_zone_load_balancing" {
description = "Whether to enable cross-zone load balancing"
type = bool
default = false
}
variable "enable_http2" {
description = "Whether to enable HTTP/2"
type = bool
default = true
}
variable "drop_invalid_header_fields" {
description = "Whether to drop invalid HTTP header fields"
type = bool
default = true
}
variable "desync_mitigation_mode" {
description = "Determines how the load balancer mitigates desync attacks"
type = string
default = "defensive"
}
variable "preserve_host_header" {
description = "Indicates whether the Host header should be preserved and forwarded to targets"
type = bool
default = false
}
variable "target_port" {
description = "The port on which targets receive traffic"
type = number
default = 80
}
variable "target_protocol" {
description = "The protocol to use for routing traffic to targets"
type = string
default = "HTTP"
}
variable "health_check_healthy_threshold" {
description = "The number of consecutive health check successes required before considering an unhealthy target healthy"
type = number
default = 3
}
variable "health_check_interval" {
description = "The approximate amount of time, in seconds, between health checks of an individual target"
type = number
default = 30
}
variable "health_check_matcher" {
description = "The HTTP codes to use when checking for a successful response from a target"
type = string
default = "200"
}
variable "health_check_path" {
description = "The destination for health checks on the targets"
type = string
default = "/"
}
variable "health_check_timeout" {
description = "The amount of time, in seconds, during which no response means a failed health check"
type = number
default = 5
}
variable "health_check_unhealthy_threshold" {
description = "The number of consecutive health check failures required before considering a target unhealthy"
type = number
default = 2
}
variable "deregistration_delay" {
description = "The amount of time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused"
type = number
default = 300
}
variable "ssl_policy" {
description = "The security policy that defines which ciphers and protocols are supported"
type = string
default = "ELBSecurityPolicy-TLS13-1-2-2021-06"
}
variable "create_http_listener" {
description = "Whether to create an HTTP listener that redirects to HTTPS"
type = bool
default = true
}
variable "additional_target_groups" {
description = "Additional target groups to create"
type = map(object({
port = number
protocol = string
# Health check settings
health_check_enabled = optional(bool)
health_check_healthy_threshold = optional(number)
health_check_interval = optional(number)
health_check_matcher = optional(string)
health_check_path = optional(string)
health_check_timeout = optional(number)
health_check_unhealthy_threshold = optional(number)
# Connection draining
deregistration_delay = optional(number)
# Routing
host_header = optional(string)
path_pattern = optional(string)
priority = number
}))
default = {}
}