-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathvariables.tf
233 lines (197 loc) · 5.97 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
# Common Configuration
variable "ami" {
description = "Amazon Machine Image (AMI) ID used for deploying Nomad clients"
type = string
nullable = false
}
variable "client_name" {
description = "Name of the Auto Scaling Group (ASG) nodes deployed as Nomad clients"
type = string
nullable = false
}
variable "client_security_groups" {
description = "List of security groups to attach to the Nomad client nodes"
type = list(string)
default = []
}
variable "client_type" {
description = "Type of client to deploy: 'ec2' or 'asg'"
type = string
default = "asg"
nullable = false
validation {
condition = contains(["ec2", "asg"], var.client_type)
error_message = "Client type can only be 'ec2' or 'asg'"
}
}
variable "cluster_name" {
description = "Identifier used for naming all resources associated with the cluster"
type = string
nullable = false
validation {
condition = endswith(var.cluster_name, "-nomad")
error_message = "The cluster_name value must be suffixed with '-nomad'"
}
}
variable "default_iam_policies" {
description = "List of IAM policies to assign to the Nomad clients"
type = list(string)
default = []
}
variable "ebs_volume_size" {
description = "The size of the EBS volume in gigabytes"
type = number
default = 100
}
variable "ebs_encryption" {
description = "Enable EBS encryption"
type = bool
default = true
}
variable "ebs_tags" {
description = "A map of custom tags to be assigned to the EBS volumes"
type = map(string)
default = {}
}
variable "enable_docker_plugin" {
description = "Whether to enable the Docker plugin on the client nodes"
type = bool
default = true
}
variable "iam_instance_profile" {
description = "Name of the existing IAM Instance Profile to use"
type = string
default = ""
}
variable "iam_tags" {
description = "A map of custom tags to be assigned to the IAM role"
type = map(string)
default = {}
}
variable "instance_type" {
description = "Instance type to use for the Nomad clients"
type = string
default = "c5a.large"
}
variable "route_53_resolver_address" {
description = "Route53 resolver address for querying DNS inside exec tasks"
type = string
nullable = false
}
variable "nomad_join_tag_value" {
description = "The value of the tag used for Nomad server auto-join"
type = string
nullable = false
}
variable "subnets" {
description = "List of subnets to assign for deploying instances"
type = list(string)
default = []
}
variable "vpc" {
description = "AWS Virtual Private Cloud (VPC) to deploy all resources in"
type = string
nullable = false
}
# Autoscale Group Configuration
variable "autoscale_metrics" {
description = "List of autoscaling metrics to monitor for Auto Scaling Group (ASG) instances"
type = list(string)
default = [
"GroupMinSize",
"GroupMaxSize",
"GroupDesiredCapacity",
"GroupInServiceInstances",
"GroupPendingInstances",
"GroupStandbyInstances",
"GroupTerminatingInstances",
"GroupTotalInstances",
]
}
variable "cluster_tags" {
description = "Key-value pairs of tags to assign to the EC2 instances spawned by the ASG"
type = map(string)
}
variable "ec2_count" {
description = "Number of Nomad client EC2 instances to run"
type = number
default = 1
}
variable "healthcheck_type" {
description = "Health check type for the ASG, either 'EC2' or 'ELB'"
type = string
default = "EC2"
validation {
condition = var.healthcheck_type == "EC2" || var.healthcheck_type == "ELB"
error_message = "The healthcheck_type variable must be either 'EC2' or 'ELB'"
}
}
variable "health_check_grace_period" {
description = "The time (in seconds) to allow instances in the Auto Scaling group to warm up before beginning health checks."
type = number
default = 180
}
variable "instance_desired_count" {
description = "Desired number of Nomad clients to run"
type = number
default = 1
}
variable "instance_max_count" {
description = "Maximum number of Nomad clients to run"
type = number
default = 3
}
variable "instance_min_count" {
description = "Minimum number of Nomad clients to run"
type = number
default = 0
}
variable "override_instance_types" {
description = "List of instance types to define in the mixed_instances_policy block"
type = list(string)
default = []
nullable = true
}
variable "target_group_arns" {
description = "List of target groups assigned in the ALB to connect to the ASG"
type = list(string)
default = []
}
variable "wait_for_capacity_timeout" {
description = "Time for which Terraform waits after ASG creation to see if instances are running."
type = string
default = "10m"
}
variable "nomad_acl_enable" {
description = "Whether to enable ACLs on the Nomad cluster or not"
type = bool
default = true
}
variable "nomad_file_limit" {
description = "Value for LimitNOFILE in nomad systemd config"
type = number
default = 900000
}
variable "nomad_client_exec_host_volumes" {
description = "A map of host volumes to configure for the Nomad client"
type = map(object({
path = string
read_only = bool
}))
default = {}
}
variable "extra_script" {
description = "Path to custom script to be run as part of cloud-init"
type = string
default = ""
}
variable "http_put_response_hop_limit" {
description = "The hop limit for HTTP PUT response for the EC2 instance metadata service"
type = number
default = 2
}
variable "http_tokens" {
description = "Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be 'optional', 'required', or 'no-preference'."
type = string
default = "optional"
}