generated from opszero/terraform-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
545 lines (463 loc) · 15.7 KB
/
variables.tf
File metadata and controls
545 lines (463 loc) · 15.7 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
variable "name" {
type = string
default = ""
description = "Name (e.g. `prod-subnet` or `subnet`)."
}
variable "environment" {
type = string
default = ""
description = "Environment (e.g. `prod`, `dev`, `staging`)."
}
variable "delimiter" {
type = string
default = "-"
description = "Delimiter to be used between `organization`, `environment`, `name` and `attributes`."
}
variable "extra_public_tags" {
type = map(any)
default = {}
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)."
}
variable "extra_private_tags" {
type = map(any)
default = {}
description = "Additional private subnet tags."
}
variable "tags" {
description = "Global tags to apply to resources."
type = map(string)
default = {
"Name" = "my-resource-name"
"Environment" = "production"
"ManagedBy" = "Terraform"
}
}
variable "managedby" {
type = string
default = "info@opszero.com"
description = "ManagedBy, eg 'info@opszero.com'"
}
variable "extra_database_tags" {
type = map(any)
default = {}
description = "Additional private subnet tags."
}
variable "availability_zones" {
type = list(string)
default = []
description = "List of Availability Zones (e.g. `['us-east-1a', 'us-east-1b', 'us-east-1c']`)."
}
variable "type" {
type = string
default = ""
description = "Type of subnets to create (`private` or `public`)."
}
variable "vpc_id" {
type = string
description = "The VPC ID where the public and private subnets will be created."
}
variable "cidr_block" {
type = string
default = null
description = "Base CIDR block which is divided into subnet CIDR blocks (e.g. `10.0.0.0/16`)."
}
variable "ipv6_cidr_block" {
type = string
default = null
description = "Base CIDR block which is divided into subnet CIDR blocks (e.g. `10.0.0.0/16`)."
}
variable "public_subnet_ids" {
type = list(string)
default = []
sensitive = true
description = "A list of public subnet ids."
# sensitive = true
}
variable "igw_id" {
type = string
default = ""
sensitive = true
description = "Internet Gateway ID that is used as a default route when creating public subnets (e.g. `igw-9c26a123`)."
}
variable "enabled" {
type = bool
default = true
description = "Set to false to prevent the module from creating any resources."
}
variable "enable_public_acl" {
type = bool
default = true
description = "Set to false to prevent the module from creating any resources."
}
variable "enable_private_acl" {
type = bool
default = true
description = "Set to false to prevent the module from creating any resources."
}
variable "nat_gateway_enabled" {
type = bool
default = false
description = "Flag to enable/disable NAT Gateways creation in public subnets."
}
variable "enable_flow_log" {
type = bool
default = false
description = "Enable subnet_flow_log logs."
}
variable "map_public_ip_on_launch" {
type = bool
default = false
description = "Specify true to indicate that instances launched into the public subnet should be assigned a public IP address."
}
variable "public_ipv6_cidrs" {
type = list(any)
default = []
description = "Public Subnet CIDR blocks (e.g. `2a05:d018:832:ca02::/64`)."
}
variable "private_ipv6_cidrs" {
type = list(any)
default = []
description = "Private Subnet CIDR blocks (e.g. `2a05:d018:832:ca02::/64`)."
}
variable "ipv4_public_cidrs" {
type = list(any)
default = []
description = "Subnet CIDR blocks (e.g. `10.0.0.0/16`)."
}
variable "ipv4_private_cidrs" {
type = list(any)
default = []
description = "Subnet CIDR blocks (e.g. `10.0.0.0/16`)."
}
variable "single_nat_gateway" {
type = bool
default = false
description = "Enable for only single NAT Gateway in one Availability Zone"
}
variable "public_subnet_assign_ipv6_address_on_creation" {
type = bool
default = false
description = "Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address."
}
variable "private_subnet_assign_ipv6_address_on_creation" {
type = bool
default = false
description = "Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address."
}
variable "public_subnet_private_dns_hostname_type_on_launch" {
type = string
default = "ip-name" # or "resource-name", depending on your requirement
description = "The type of private DNS hostname to assign to instances in this subnet at launch. Must be either 'ip-name' or 'resource-name'."
}
variable "private_subnet_private_dns_hostname_type_on_launch" {
type = string
default = null
description = "The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`"
}
variable "public_subnet_ipv6_native" {
type = bool
default = false
description = "Indicates whether to create an IPv6-only public subnet. Default: `false`"
}
variable "private_subnet_ipv6_native" {
type = bool
default = false
description = "Indicates whether to create an IPv6-only private subnet. Default: `false`"
}
variable "enable_ipv6" {
type = bool
default = false
description = "Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block"
}
variable "public_subnet_enable_dns64" {
type = bool
default = false
description = "Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true`"
}
variable "private_subnet_enable_dns64" {
type = bool
default = false
description = "Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true`"
}
variable "public_subnet_enable_resource_name_dns_a_record_on_launch" {
type = bool
default = false
description = "Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`"
}
variable "private_subnet_enable_resource_name_dns_a_record_on_launch" {
type = bool
default = false
description = "Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`"
}
variable "public_subnet_enable_resource_name_dns_aaaa_record_on_launch" {
type = bool
default = false
description = "Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `true`"
}
variable "private_subnet_enable_resource_name_dns_aaaa_record_on_launch" {
type = bool
default = false
description = "Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `true`"
}
variable "public_inbound_acl_rules" {
type = list(map(string))
default = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "-1"
cidr_block = "0.0.0.0/0"
},
]
description = "Public subnets inbound network ACLs"
}
variable "public_outbound_acl_rules" {
type = list(map(string))
default = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "-1"
cidr_block = "0.0.0.0/0"
},
]
description = "Public subnets outbound network ACLs"
}
variable "private_inbound_acl_rules" {
type = list(map(string))
default = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "-1"
cidr_block = "0.0.0.0/0"
},
]
description = "Private subnets inbound network ACLs"
}
variable "private_outbound_acl_rules" {
type = list(map(string))
default = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "-1"
cidr_block = "0.0.0.0/0"
},
]
description = "Private subnets outbound network ACLs"
}
variable "nat_gateway_destination_cidr_block" {
type = string
default = "0.0.0.0/0" # Commonly used for internet access
description = "The CIDR block for the NAT gateway route."
}
variable "public_rt_ipv4_destination_cidr" {
type = string
default = "0.0.0.0/0"
description = "The destination ipv4 CIDR block."
}
variable "public_rt_ipv6_destination_cidr" {
type = string
default = "::/0"
description = "The destination ipv6 CIDR block."
}
variable "ipv4_database_cidrs" {
type = list(any)
default = []
description = "Subnet CIDR blocks (e.g. `10.0.0.0/16`)."
}
variable "database_ipv6_cidrs" {
type = list(any)
default = []
description = "database Subnet CIDR blocks (e.g. `2a05:d018:832:ca02::/64`)."
}
variable "map_database_ip_on_launch" {
type = bool
default = false
description = "Specify true to indicate that instances launched into the database subnet should be assigned a public IP address."
}
variable "database_subnet_ipv6_native" {
type = bool
default = false
description = "Indicates whether to create an IPv6-only database subnet. Default: `false`"
}
variable "database_subnet_private_dns_hostname_type_on_launch" {
type = string
default = null
description = "The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`"
}
variable "database_subnet_enable_resource_name_dns_aaaa_record_on_launch" {
type = bool
default = false
description = "Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `true`"
}
variable "database_subnet_enable_resource_name_dns_a_record_on_launch" {
type = bool
default = false
description = "Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`"
}
variable "database_subnet_assign_ipv6_address_on_creation" {
type = bool
default = false
description = "Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address."
}
variable "database_subnet_enable_dns64" {
type = bool
default = false
description = "Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true`"
}
variable "enable_database_acl" {
type = bool
default = true
description = "Set to false to prevent the module from creating any resources."
}
variable "database_inbound_acl_rules" {
type = list(map(string))
default = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "-1"
cidr_block = "0.0.0.0/0"
},
]
description = "database subnets inbound network ACLs"
}
variable "database_outbound_acl_rules" {
type = list(map(string))
default = [
{
rule_number = 100
rule_action = "allow"
from_port = 0
to_port = 0
protocol = "-1"
cidr_block = "0.0.0.0/0"
},
]
description = "database subnets outbound network ACLs"
}
variable "enable_lni_at_device_index" {
type = number
default = null
description = "Indicates the device position for local network interfaces in this subnet. This is used for AWS Outposts only."
}
variable "map_customer_owned_ip_on_launch" {
type = bool
default = false
description = "Whether to map customer-owned IPs on launch"
}
variable "customer_owned_ipv4_pool" {
type = string
default = ""
description = "The customer-owned IPv4 address pool for the subnet"
}
variable "outpost_arn" {
type = string
default = ""
description = "The ARN of the Outpost to create the subnet in"
}
output "created_subnet_ids" {
value = aws_subnet.public[*].id
description = "The IDs of the subnets created in the public availability zones."
}
##### database_subnet_flow_log #####
variable "flow_log_destination_arn" {
type = string
default = null
sensitive = true
description = "ARN of resource in which flow log will be sent."
}
variable "flow_log_destination_type" {
type = string
default = "cloud-watch-logs"
description = "Type of flow log destination. Can be s3 or cloud-watch-logs"
}
variable "flow_log_traffic_type" {
type = string
default = "ALL"
description = "Type of traffic to capture. Valid values: ACCEPT,REJECT, ALL."
}
variable "flow_log_log_format" {
type = string
default = null
description = "The fields to include in the flow log record, in the order in which they should appear"
}
variable "flow_log_iam_role_arn" {
type = string
default = null
description = "The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow_log_destination_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided"
}
variable "flow_log_max_aggregation_interval" {
type = number
default = 600
description = "The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. Valid Values: `60` seconds or `600` seconds"
}
##### Optional variables added
variable "flow_log_deliver_cross_account_role" {
type = string
default = null
description = "The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts."
}
variable "flow_log_eni_id" {
type = string
default = null
description = "Elastic Network Interface ID to attach to."
}
variable "flow_log_transit_gateway_id" {
type = string
default = null
description = "Transit Gateway ID to attach to."
}
variable "flow_log_transit_gateway_attachment_id" {
type = string
default = null
description = "Transit Gateway Attachment ID to attach to."
}
# Variables for destination options (if logging to S3)
variable "flow_log_file_format" {
type = string
default = null
description = "(Optional) The format for the flow log. Valid values: `plain-text`, `parquet`"
}
variable "flow_log_hive_compatible_partitions" {
type = bool
default = false
description = "(Optional) Indicates whether to use Hive-compatible prefixes for flow logs stored in Amazon S3"
}
variable "flow_log_per_hour_partition" {
type = bool
default = false
description = "(Optional) Indicates whether to partition the flow log per hour. This reduces the cost and response time for queries"
}
variable "flow_log_vpc_id" {
type = string
default = null
description = "VPC ID to attach to."
}
variable "eni_id" {
type = string
default = null
description = "Elastic Network Interface ID to attach to."
}
variable "transit_gateway_id" {
type = string
default = null
description = "Transit Gateway ID to attach to."
}
variable "deliver_cross_account_role" {
type = string
default = null
description = "ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts."
}