forked from LeanerCloud/terraform-aws-autospotting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
294 lines (251 loc) · 8.63 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
# Autospotting configuration
variable "autospotting_allowed_instance_types" {
description = <<EOF
Comma separated list of allowed instance types for spot requests,
in case you want to exclude specific types (also support globs).
Example: 't2.*,m4.large'
Using the 'current' magic value will only allow the same type as the
on-demand instances set in the group's launch configuration.
EOF
default = ""
}
variable "autospotting_cron_schedule_state" {
description = <<EOF
Controls whether or not to run AutoSpotting within a time interval
given in the 'autospotting_cron_schedule' parameter. Setting this to 'off'
would make it run only outside the defined interval. This is a global value
that can be overridden on a per-AutoScaling-group basis using the
'autospotting_cron_schedule_state' tag set on the AutoScaling group
Example: 'off'
EOF
default = "on"
}
variable "autospotting_cron_schedule" {
description = <<EOF
Restrict AutoSpotting to run within a time interval given as a
simplified cron-like rule format restricted to hours and days of week.
Example: '9-18 1-5' would run it during the work-week and only within
the usual 9-18 office hours.
This is a global value that can be
overridden on a per-group basis using the 'autospotting_cron_schedule'
tag set on the AutoScaling group. The default value '* *' makes it run
at all times.
EOF
default = "* *"
}
variable "autospotting_cron_timezone" {
description = <<EOF
Sets the timezone in which to check the CronSchedule.
Example: If the timezone is set to 'UTC' and the CronSchedule is '9-18 1-5'
it would start the interval at 9AM UTC, with the timezone set to 'Europe/London'
it would start the interval at 9AM BST (10am UTC) or 9AM GMT (9AM UTC)
depending on daylight savings.
EOF
default = "UTC"
}
variable "autospotting_disallowed_instance_types" {
description = <<EOF
Comma separated list of disallowed instance types for spot requests,
in case you want to exclude specific types (also support globs).
Example: 't2.*,m4.large'
EOF
default = ""
}
variable "autospotting_instance_termination_method" {
description = <<EOF
Instance termination method. Must be one of 'autoscaling' (default) or
'detach' (compatibility mode, not recommended).
EOF
default = "autoscaling"
}
variable "autospotting_min_on_demand_number" {
description = "Minimum on-demand instances to keep in absolute value"
type = number
default = 0
}
variable "autospotting_min_on_demand_percentage" {
description = "Minimum on-demand instances to keep in percentage"
type = number
default = "0.0"
}
variable "autospotting_on_demand_price_multiplier" {
description = "Multiplier for the on-demand price"
type = number
default = "1.0"
}
variable "autospotting_patch_beanswalk_userdata" {
description = <<EOF
Controls whether AutoSpotting patches Elastic Beanstalk UserData
scripts to use the instance role when calling CloudFormation helpers
instead of the standard CloudFormation authentication method.
After creating this CloudFormation stack, you must add the
AutoSpotting's ElasticBeanstalk managed policy to your Beanstalk
instance profile/role if you turn this option to true
EOF
type = bool
default = false
}
variable "autospotting_spot_product_description" {
description = <<EOF
The Spot Product or operating system to use when looking
up spot price history in the market.
Valid choices
- Linux/UNIX | SUSE Linux | Windows
- Linux/UNIX (Amazon VPC) | SUSE Linux (Amazon VPC) | Windows (Amazon VPC)
EOF
default = "Linux/UNIX (Amazon VPC)"
}
variable "autospotting_spot_product_premium" {
description = <<EOF
The Product Premium hourly charge to apply to the on demand price to improve spot
selection and savings calculations when using a premium instance type
such as RHEL.
EOF
type = number
default = 0
}
variable "autospotting_spot_price_buffer_percentage" {
description = "Percentage above the current spot price to place the bid"
default = "10.0"
}
variable "autospotting_termination_notification_action" {
description = <<EOF
Action to do when receiving a Spot Instance Termination Notification.
Must be one of 'auto' (terminate if lifecycle hook is defined, or else
detach) [default], 'terminate' (lifecycle hook triggered), 'detach'
(lifecycle hook not triggered)
Allowed values: auto | detach | terminate
EOF
default = "auto"
}
variable "autospotting_bidding_policy" {
description = "Bidding policy for the spot bid"
default = "normal"
}
variable "autospotting_regions_enabled" {
description = "Regions in which autospotting is enabled"
default = []
}
variable "autospotting_tag_filters" {
description = <<EOF
Tags to filter which ASGs autospotting considers. If blank
by default this will search for asgs with spot-enabled=true (when in opt-in
mode) and will skip those tagged with spot-enabled=false when in opt-out
mode.
You can set this to many tags, for example:
spot-enabled=true,Environment=dev,Team=vision
EOF
default = ""
}
variable "autospotting_tag_filtering_mode" {
description = <<EOF
Controls the tag-based ASG filter. Supported values: 'opt-in' or 'opt-out'.
Defaults to opt-in mode, in which it only acts against the tagged groups. In
opt-out mode it works against all groups except for the tagged ones.
EOF
default = "opt-in"
}
variable "autospotting_license" {
description = <<EOF
Autospotting License code. Allowed options are:
'evaluation', 'I_am_supporting_it_on_Patreon',
'I_contributed_to_development_within_the_last_year',
'I_built_it_from_source_code'
EOF
default = "evaluation"
}
# Lambda configuration
variable "lambda_zipname" {
description = "Name of the archive, relative to the module"
default = null
}
variable "lambda_s3_bucket" {
description = "Bucket which the archive is stored in"
default = "cloudprowess"
}
variable "lambda_s3_key" {
description = "Key in S3 under which the archive of the main Lambda function is stored"
default = "nightly/lambda.zip"
}
variable "lambda_manage_asg_s3_key" {
description = "Key in S3 under which the archive of the manage-asg Lambda function is stored"
default = "nightly/manage_asg.zip"
}
variable "lambda_runtime" {
description = "Environment the lambda function runs in"
default = "go1.x"
}
variable "lambda_memory_size" {
description = "Memory size allocated to the lambda run"
default = 1024
}
variable "lambda_timeout" {
description = "Timeout after which the lambda timeout"
default = 300
}
variable "lambda_run_frequency" {
description = "How frequent should lambda run"
default = "rate(5 minutes)"
}
variable "lambda_tags" {
description = "Tags to be applied to the Lambda function"
default = {
# You can add more values below
Name = "autospotting"
}
}
variable "unsupported_regions" {
description = <<EOF
List of relatively recently launched/announced regions that are currently
not supported by AutoSpotting.
This list is expected to evolve over time as new regious are announced or
made available to AWS customers.
In case you notice errors mentioning providers.tf, such as reported in
https://github.com/AutoSpotting/terraform-aws-autospotting/issues/38
it's usually a sign that this list needs to be updated. The line in
providers.tf which may be mentioned in the error message is a good way
to see which region needs to be added. On another hand if you're trying
to run AutoSpotting in a recently launched region mentioned below, you
can always override this variable to remove that region. If the region
actually works fine, please also send a pull request deleting it from
this list to add support for this new region.
EOF
type = list(string)
default = [
"af-south-1",
"ap-east-1",
"ap-northeast-3",
"eu-south-1",
"me-south-1",
]
}
# Label configuration
variable "label_context" {
description = "Used to pass in label module context"
type = object({
namespace = string
environment = string
stage = string
name = string
enabled = bool
delimiter = string
attributes = list(string)
label_order = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
})
default = {
namespace = ""
environment = ""
stage = ""
name = ""
enabled = true
delimiter = ""
attributes = []
label_order = []
tags = {}
additional_tag_map = {}
regex_replace_chars = ""
}
}