-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
variables.tf
432 lines (361 loc) · 13.2 KB
/
variables.tf
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
variable "create" {
description = "Whether to create an instance"
type = bool
default = true
}
variable "name" {
description = "Name to be used on EC2 instance created"
type = string
default = ""
}
variable "ami_ssm_parameter" {
description = "SSM parameter name for the AMI ID. For Amazon Linux AMI SSM parameters see [reference](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-public-parameters-ami.html)"
type = string
default = "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
}
variable "ami" {
description = "ID of AMI to use for the instance"
type = string
default = null
}
variable "ignore_ami_changes" {
description = "Whether changes to the AMI ID changes should be ignored by Terraform. Note - changing this value will result in the replacement of the instance"
type = bool
default = false
}
variable "associate_public_ip_address" {
description = "Whether to associate a public IP address with an instance in a VPC"
type = bool
default = null
}
variable "maintenance_options" {
description = "The maintenance options for the instance"
type = any
default = {}
}
variable "availability_zone" {
description = "AZ to start the instance in"
type = string
default = null
}
variable "capacity_reservation_specification" {
description = "Describes an instance's Capacity Reservation targeting option"
type = any
default = {}
}
variable "cpu_credits" {
description = "The credit option for CPU usage (unlimited or standard)"
type = string
default = null
}
variable "disable_api_termination" {
description = "If true, enables EC2 Instance Termination Protection"
type = bool
default = null
}
variable "ebs_block_device" {
description = "Additional EBS block devices to attach to the instance"
type = list(any)
default = []
}
variable "ebs_optimized" {
description = "If true, the launched EC2 instance will be EBS-optimized"
type = bool
default = null
}
variable "enclave_options_enabled" {
description = "Whether Nitro Enclaves will be enabled on the instance. Defaults to `false`"
type = bool
default = null
}
variable "ephemeral_block_device" {
description = "Customize Ephemeral (also known as Instance Store) volumes on the instance"
type = list(map(string))
default = []
}
variable "get_password_data" {
description = "If true, wait for password data to become available and retrieve it"
type = bool
default = null
}
variable "hibernation" {
description = "If true, the launched EC2 instance will support hibernation"
type = bool
default = null
}
variable "host_id" {
description = "ID of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host"
type = string
default = null
}
variable "iam_instance_profile" {
description = "IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile"
type = string
default = null
}
variable "instance_initiated_shutdown_behavior" {
description = "Shutdown behavior for the instance. Amazon defaults this to stop for EBS-backed instances and terminate for instance-store instances. Cannot be set on instance-store instance" # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior
type = string
default = null
}
variable "instance_type" {
description = "The type of instance to start"
type = string
default = "t3.micro"
}
variable "instance_tags" {
description = "Additional tags for the instance"
type = map(string)
default = {}
}
variable "ipv6_address_count" {
description = "A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet"
type = number
default = null
}
variable "ipv6_addresses" {
description = "Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface"
type = list(string)
default = null
}
variable "key_name" {
description = "Key name of the Key Pair to use for the instance; which can be managed using the `aws_key_pair` resource"
type = string
default = null
}
variable "launch_template" {
description = "Specifies a Launch Template to configure the instance. Parameters configured on this resource will override the corresponding parameters in the Launch Template"
type = map(string)
default = {}
}
variable "metadata_options" {
description = "Customize the metadata options of the instance"
type = map(string)
default = {
"http_endpoint" = "enabled"
"http_put_response_hop_limit" = 1
"http_tokens" = "optional"
}
}
variable "monitoring" {
description = "If true, the launched EC2 instance will have detailed monitoring enabled"
type = bool
default = null
}
variable "network_interface" {
description = "Customize network interfaces to be attached at instance boot time"
type = list(map(string))
default = []
}
variable "private_dns_name_options" {
description = "Customize the private DNS name options of the instance"
type = map(string)
default = {}
}
variable "placement_group" {
description = "The Placement Group to start the instance in"
type = string
default = null
}
variable "private_ip" {
description = "Private IP address to associate with the instance in a VPC"
type = string
default = null
}
variable "root_block_device" {
description = "Customize details about the root block device of the instance. See Block Devices below for details"
type = list(any)
default = []
}
variable "secondary_private_ips" {
description = "A list of secondary private IPv4 addresses to assign to the instance's primary network interface (eth0) in a VPC. Can only be assigned to the primary network interface (eth0) attached at instance creation, not a pre-existing network interface i.e. referenced in a `network_interface block`"
type = list(string)
default = null
}
variable "source_dest_check" {
description = "Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs"
type = bool
default = null
}
variable "subnet_id" {
description = "The VPC Subnet ID to launch in"
type = string
default = null
}
variable "tags" {
description = "A mapping of tags to assign to the resource"
type = map(string)
default = {}
}
variable "tenancy" {
description = "The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host"
type = string
default = null
}
variable "user_data" {
description = "The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead"
type = string
default = null
}
variable "user_data_base64" {
description = "Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption"
type = string
default = null
}
variable "user_data_replace_on_change" {
description = "When used in combination with user_data or user_data_base64 will trigger a destroy and recreate when set to true. Defaults to false if not set"
type = bool
default = null
}
variable "volume_tags" {
description = "A mapping of tags to assign to the devices created by the instance at launch time"
type = map(string)
default = {}
}
variable "enable_volume_tags" {
description = "Whether to enable volume tags (if enabled it conflicts with root_block_device tags)"
type = bool
default = true
}
variable "vpc_security_group_ids" {
description = "A list of security group IDs to associate with"
type = list(string)
default = null
}
variable "timeouts" {
description = "Define maximum timeout for creating, updating, and deleting EC2 instance resources"
type = map(string)
default = {}
}
variable "cpu_options" {
description = "Defines CPU options to apply to the instance at launch time."
type = any
default = {}
}
variable "cpu_core_count" {
description = "Sets the number of CPU cores for an instance" # This option is only supported on creation of instance type that support CPU Options https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#cpu-options-supported-instances-values
type = number
default = null
}
variable "cpu_threads_per_core" {
description = "Sets the number of CPU threads per core for an instance (has no effect unless cpu_core_count is also set)"
type = number
default = null
}
# Spot instance request
variable "create_spot_instance" {
description = "Depicts if the instance is a spot instance"
type = bool
default = false
}
variable "spot_price" {
description = "The maximum price to request on the spot market. Defaults to on-demand price"
type = string
default = null
}
variable "spot_wait_for_fulfillment" {
description = "If set, Terraform will wait for the Spot Request to be fulfilled, and will throw an error if the timeout of 10m is reached"
type = bool
default = null
}
variable "spot_type" {
description = "If set to one-time, after the instance is terminated, the spot request will be closed. Default `persistent`"
type = string
default = null
}
variable "spot_launch_group" {
description = "A launch group is a group of spot instances that launch together and terminate together. If left empty instances are launched and terminated individually"
type = string
default = null
}
variable "spot_block_duration_minutes" {
description = "The required duration for the Spot instances, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360)"
type = number
default = null
}
variable "spot_instance_interruption_behavior" {
description = "Indicates Spot instance behavior when it is interrupted. Valid values are `terminate`, `stop`, or `hibernate`"
type = string
default = null
}
variable "spot_valid_until" {
description = "The end date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ)"
type = string
default = null
}
variable "spot_valid_from" {
description = "The start date and time of the request, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ)"
type = string
default = null
}
variable "disable_api_stop" {
description = "If true, enables EC2 Instance Stop Protection"
type = bool
default = null
}
variable "putin_khuylo" {
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
type = bool
default = true
}
################################################################################
# IAM Role / Instance Profile
################################################################################
variable "create_iam_instance_profile" {
description = "Determines whether an IAM instance profile is created or to use an existing IAM instance profile"
type = bool
default = false
}
variable "iam_role_name" {
description = "Name to use on IAM role created"
type = string
default = null
}
variable "iam_role_use_name_prefix" {
description = "Determines whether the IAM role name (`iam_role_name` or `name`) is used as a prefix"
type = bool
default = true
}
variable "iam_role_path" {
description = "IAM role path"
type = string
default = null
}
variable "iam_role_description" {
description = "Description of the role"
type = string
default = null
}
variable "iam_role_permissions_boundary" {
description = "ARN of the policy that is used to set the permissions boundary for the IAM role"
type = string
default = null
}
variable "iam_role_policies" {
description = "Policies attached to the IAM role"
type = map(string)
default = {}
}
variable "iam_role_tags" {
description = "A map of additional tags to add to the IAM role/profile created"
type = map(string)
default = {}
}
################################################################################
# Elastic IP
################################################################################
variable "create_eip" {
description = "Determines whether a public EIP will be created and associated with the instance."
type = bool
default = false
}
variable "eip_domain" {
description = "Indicates if this EIP is for use in VPC"
type = string
default = "vpc"
}
variable "eip_tags" {
description = "A map of additional tags to add to the eip"
type = map(string)
default = {}
}