This repository has been archived by the owner on Jan 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 190
/
Copy pathvariables.tf
241 lines (202 loc) · 8.44 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
# ---------------------------------------------------------------------------------------------------------------------
# REQUIRED PARAMETERS
# You must provide a value for each of these parameters.
# ---------------------------------------------------------------------------------------------------------------------
variable "cluster_name" {
description = "The name of the Nomad cluster (e.g. nomad-servers-stage). This variable is used to namespace all resources created by this module."
type = string
}
variable "ami_id" {
description = "The ID of the AMI to run in this cluster. Should be an AMI that had Nomad installed and configured by the install-nomad module."
type = string
}
variable "instance_type" {
description = "The type of EC2 Instances to run for each node in the cluster (e.g. t2.micro)."
type = string
}
variable "vpc_id" {
description = "The ID of the VPC in which to deploy the cluster"
type = string
}
variable "allowed_inbound_cidr_blocks" {
description = "A list of CIDR-formatted IP address ranges from which the EC2 Instances will allow connections to Nomad"
type = list(string)
}
variable "user_data" {
description = "A User Data script to execute while the server is booting. We remmend passing in a bash script that executes the run-nomad script, which should have been installed in the AMI by the install-nomad module."
type = string
}
variable "min_size" {
description = "The minimum number of nodes to have in the cluster. If you're using this to run Nomad servers, we strongly recommend setting this to 3 or 5."
type = number
}
variable "max_size" {
description = "The maximum number of nodes to have in the cluster. If you're using this to run Nomad servers, we strongly recommend setting this to 3 or 5."
type = number
}
variable "desired_capacity" {
description = "The desired number of nodes to have in the cluster. If you're using this to run Nomad servers, we strongly recommend setting this to 3 or 5."
type = number
}
# ---------------------------------------------------------------------------------------------------------------------
# OPTIONAL PARAMETERS
# These parameters have reasonable defaults.
# ---------------------------------------------------------------------------------------------------------------------
variable "asg_name" {
description = "The name to use for the Auto Scaling Group"
type = string
default = ""
}
variable "subnet_ids" {
description = "The subnet IDs into which the EC2 Instances should be deployed. We recommend one subnet ID per node in the cluster_size variable. At least one of var.subnet_ids or var.availability_zones must be non-empty."
type = list(string)
default = null
}
variable "availability_zones" {
description = "The availability zones into which the EC2 Instances should be deployed. We recommend one availability zone per node in the cluster_size variable. At least one of var.subnet_ids or var.availability_zones must be non-empty."
type = list(string)
default = null
}
variable "ssh_key_name" {
description = "The name of an EC2 Key Pair that can be used to SSH to the EC2 Instances in this cluster. Set to an empty string to not associate a Key Pair."
type = string
default = ""
}
variable "allowed_ssh_cidr_blocks" {
description = "A list of CIDR-formatted IP address ranges from which the EC2 Instances will allow SSH connections"
type = list(string)
default = []
}
variable "cluster_tag_key" {
description = "Add a tag with this key and the value var.cluster_tag_value to each Instance in the ASG."
type = string
default = "nomad-servers"
}
variable "cluster_tag_value" {
description = "Add a tag with key var.cluster_tag_key and this value to each Instance in the ASG. This can be used to automatically find other Consul nodes and form a cluster."
type = string
default = "auto-join"
}
variable "termination_policies" {
description = "A list of policies to decide how the instances in the auto scale group should be terminated. The allowed values are OldestInstance, NewestInstance, OldestLaunchConfiguration, ClosestToNextInstanceHour, Default."
type = string
default = "Default"
}
variable "associate_public_ip_address" {
description = "If set to true, associate a public IP address with each EC2 Instance in the cluster."
type = bool
default = false
}
variable "tenancy" {
description = "The tenancy of the instance. Must be one of: default or dedicated."
type = string
default = "default"
}
variable "root_volume_ebs_optimized" {
description = "If true, the launched EC2 instance will be EBS-optimized."
type = bool
default = false
}
variable "root_volume_type" {
description = "The type of volume. Must be one of: standard, gp2, or io1."
type = string
default = "standard"
}
variable "root_volume_size" {
description = "The size, in GB, of the root EBS volume."
type = number
default = 50
}
variable "root_volume_delete_on_termination" {
description = "Whether the volume should be destroyed on instance termination."
default = true
type = bool
}
variable "wait_for_capacity_timeout" {
description = "A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. Setting this to '0' causes Terraform to skip all Capacity Waiting behavior."
type = string
default = "10m"
}
variable "health_check_type" {
description = "Controls how health checking is done. Must be one of EC2 or ELB."
type = string
default = "EC2"
}
variable "health_check_grace_period" {
description = "Time, in seconds, after instance comes into service before checking health."
type = number
default = 300
}
variable "instance_profile_path" {
description = "Path in which to create the IAM instance profile."
type = string
default = "/"
}
variable "http_port" {
description = "The port to use for HTTP"
type = number
default = 4646
}
variable "rpc_port" {
description = "The port to use for RPC"
type = number
default = 4647
}
variable "serf_port" {
description = "The port to use for Serf"
type = number
default = 4648
}
variable "ssh_port" {
description = "The port used for SSH connections"
type = number
default = 22
}
variable "security_groups" {
description = "Additional security groups to attach to the EC2 instances"
type = list(string)
default = []
}
variable "tags" {
description = "List of extra tag blocks added to the autoscaling group configuration. Each element in the list is a map containing keys 'key', 'value', and 'propagate_at_launch' mapped to the respective values."
type = list(object({
key = string
value = string
propagate_at_launch = bool
}))
default = []
}
variable "ebs_block_devices" {
description = "List of ebs volume definitions for those ebs_volumes that should be added to the instances created with the EC2 launch-configuration. Each element in the list is a map containing keys defined for ebs_block_device (see: https://www.terraform.io/docs/providers/aws/r/launch_configuration.html#ebs_block_device."
# We can't narrow the type down more than "any" because if we use list(object(...)), then all the fields in the
# object will be required (whereas some, such as encrypted, should be optional), and if we use list(map(...)), all
# the values in the map must be of the same type, whereas we need some to be strings, some to be bools, and some to
# be ints. So, we have to fall back to just any ugly "any."
type = any
default = []
# Example:
#
# default = [
# {
# device_name = "/dev/xvdh"
# volume_type = "gp2"
# volume_size = 300
# encrypted = true
# }
# ]
}
variable "protect_from_scale_in" {
description = "(Optional) Allows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events."
type = bool
default = false
}
variable "allow_outbound_cidr_blocks" {
description = "Allow outbound traffic to these CIDR blocks."
type = list(string)
default = ["0.0.0.0/0"]
}
variable "iam_permissions_boundary" {
description = "If set, restricts the created IAM role to the given permissions boundary"
type = string
default = null
}