-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
306 lines (289 loc) · 7.07 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
# environment vars
#---------------------------------------
variable "environment" {
type = string
default = "DEV"
validation {
condition = contains(["DEV", "QA", "PROD"], upper(var.environment))
error_message = "The 'environment' tag must be one of 'DEV','QA', or 'PROD'."
}
validation {
condition = upper(var.environment) == var.environment
error_message = "The 'environment' tag must be in all in uppercase."
}
}
variable "aws_region" {
type = string
description = "AWS region"
default = "us-east-1"
}
variable "app_name" {
type = string
description = "application name"
default = "wordpress-app"
}
variable "az_count" {
type = number
description = "Number of availability zones to use"
default = 2
}
# VPC
#----------------------------------------
variable "vpc_name" {
type = string
description = "VPC name"
default = "vpc"
}
variable "vpc_cidr" {
type = string
description = "VPC cidr"
default = "10.0.0.0/16"
}
variable "enable_dns_hostnames" {
type = bool
description = "enable dns hostnames"
default = true
}
# Subnets
#----------------------------------------
# Public
variable "map_public_ip_on_launch" {
type = bool
description = "enable auto-assign ipv4"
default = true
}
variable "public_newbits" {
type = number
description = "number to add for public_subnet 'newbits' cidrsubnet() function"
default = 8
}
variable "public_newnum" {
type = number
description = "number to add for public_subnet 'newnum' cidrsubnet() function"
default = 100
}
# Private
variable "private_newbits" {
type = number
description = "number to add for private_subnet 'newbits' cidrsubnet() function"
default = 8
}
variable "private_newnum" {
type = number
description = "number to add for private_subnet 'newnum' cidrsubnet() function"
default = 8
}
# NAT gateway
#----------------------------------------
variable "enable_nat_gateway" {
type = bool
description = "enable NAT gateway"
default = false
}
variable "single_nat_gateway" {
type = bool
description = "enable single NAT"
default = false
}
variable "one_nat_gateway_per_az" {
type = bool
description = "enable NAT gateway in each AZ"
default = false
}
# Security groups
#----------------------------------------
variable "sg_timeout" {
type = string
description = "Security group delete timeout"
default = "5m"
}
variable "ssh_cidr" {
type = string
description = "ssh cidrs"
default = "0.0.0.0/0"
}
variable "db_port" {
type = number
description = "wordpress db port"
default = 3306
}
# RDS wordpress
#----------------------------------------
variable "db_allocated_storage" {
type = number
description = "db allocated storage"
default = 20
}
variable "db_max_allocated_storage" {
type = number
description = "wordpress db max allocated storage"
default = 500
}
variable "db_name" {
type = string
description = "wordpress db name"
}
variable "db_instance_class" {
type = string
description = "wordpress db instance type"
default = "db.t2.micro"
}
variable "db_username" {
type = string
description = "wordpress db username"
sensitive = true
}
variable "db_password" {
type = string
description = "wordpress db password"
sensitive = true
}
variable "db_engine" {
type = string
description = "wordpress db engine"
default = "mysql"
}
variable "db_engine_version" {
type = string
description = "wordpress db engine version"
default = "8.0.32"
}
variable "db_publicly_accessible" {
type = bool
description = "wordpress db publicly accessible"
default = false
}
variable "db_deletion_protection" {
type = bool
description = "wordpress db deletion protection"
default = false
}
variable "db_skip_final_snapshot" {
type = bool
description = "skip final snapshot"
default = true
}
# ALB
#----------------------------------------
variable "web_alb_name" {
type = string
description = "alb name"
default = "web-alb"
}
variable "web_alb_type" {
type = string
description = "alb type"
default = "application"
}
variable "web_alb_internal" {
type = bool
description = "internal facing"
default = false
}
#target group
variable "web_alb_tg_http_name" {
type = string
description = "target group name"
default = "wp-server-tg-http"
}
variable "web_alb_tg_http_protocol" {
type = string
description = "target group protocol"
default = "HTTP"
}
variable "web_alb_tg_http_port" {
type = number
description = "target group port"
default = 80
}
variable "web_alb_tg_http_type" {
type = string
description = "target group type"
default = "instance"
}
#listener
variable "web_alb_listener_http_protocol" {
type = string
description = "http listener protocol"
default = "HTTP"
}
variable "web_alb_listener_http_port" {
type = number
description = "http listener port"
default = 80
}
variable "web_alb_listener_http_action_type" {
type = string
description = "http listener action type"
default = "forward"
}
#Launch template
variable "wordpress_server_name" {
type = string
description = "wordpress template name"
default = "wordpress-server"
}
variable "wordpress_template_instance_type" {
type = string
description = "wordpress server type"
default = "t2.micro"
}
variable "key_name" {
type = string
description = "wordpress server key pair"
sensitive = true
}
variable "wordpress_template_enable_monitoring" {
type = bool
description = "wordpress server enable monitoring"
default = true
}
# WordPress ASG
#----------------------------------------
variable "wordpress_asg_min_size" {
type = number
description = "asg min size"
default = 2
}
variable "wordpress_asg_max_size" {
type = number
description = "asg max size"
default = 4
}
variable "wordpress_asg_health_check_type" {
type = string
description = "asg health check type "
default = "ELB"
}
#Wordpress account
variable "wp_username" {
type = string
description = "wordpress username"
sensitive = true
}
variable "wp_password" {
type = string
description = "wordpress password"
sensitive = true
}
variable "wp_email" {
type = string
description = "wordpress email"
sensitive = true
}
#Scaling policy
variable "wordpress_asg_scaling_policy_type" {
type = string
description = "wordpress asg scalng policy type"
default = "TargetTrackingScaling"
}
variable "wordpress_asg_scaling_policy_metric_type" {
type = string
description = "wordpress asg scalng policy metric type"
default = "ASGAverageCPUUtilization"
}
variable "wordpress_asg_scaling_policy_target_value" {
type = number
description = "wordpress asg scalng policy target value"
default = 75.0
}