-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
263 lines (233 loc) · 5.38 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
# environment vars
#---------------------------------------
variable "environment" {
type = string
default = "Dev"
}
variable "aws_region" {
type = string
default = "us-east-1"
}
# naming vars
#---------------------------------------
variable "app_name" {
type = string
description = "app name prefix for naming"
default = "shoppr"
}
# vpc vars
#----------------------------------------
variable "vpc_cidr" {
type = string
description = "VPC cidr block"
default = "10.0.0.0/16"
}
variable "enable_dns_hostnames" {
type = bool
description = "enable dns hostnames"
default = true
}
# common cidrs
#----------------------------------------
variable "all_traffic" {
type = string
description = "all all traffic"
default = "0.0.0.0/0"
}
variable "NAT_subnet" {
type = string
description = "subnet location for NAT"
default = "us"
}
# private subnet vars
#----------------------------------------
variable "private_subnets" {
default = {
"private-subnet-1" = 0
"private-subnet-2" = 1
}
}
# public subnet vars
#----------------------------------------
variable "public_subnets" {
default = {
"public-subnet-1" = 0
"public-subnet-2" = 1
}
}
variable "auto_ipv4" {
type = bool
description = "enable auto-assign ipv4"
default = true
}
# security group vars
#----------------------------------------
variable "ssh_sg" {
type = map(any)
description = "ssh security group vars "
default = {
"cidr_block" = "0.0.0.0/0"
"create_before_destroy" = true
"timeout_delete" = "2m"
}
}
variable "web_access_sg" {
type = map(any)
description = "web access security group vars "
default = {
"create_before_destroy" = true
"timeout_delete" = "2m"
}
}
variable "alb_access_sg" {
type = map(any)
description = "alb instance security group vars "
default = {
"create_before_destroy" = true
"timeout_delete" = "2m"
}
}
# ec2 vars
#----------------------------------------
variable "web_server_name" {
type = string
default = "web-server"
}
variable "web_server_ami" {
type = string
description = "Instance AMI: Ubuntu 22.04"
default = "ami-04b70fa74e45c3917"
}
variable "web_server_type" {
type = string
default = "t2.micro"
}
variable "key_pair" {
type = string
description = "ec2 key pair"
default = "webServer_key"
}
variable "user_data_file" {
type = string
description = "user data file path"
default = "pre-deployment.sh"
}
variable "user_data_bastion_host" {
type = string
description = "user data file path"
default = "hosted-runner.sh"
}
# ASG vars
#----------------------------------------
variable "web_asg_capacity" {
type = map(any)
description = "min, max, and desired instance capacity"
default = {
"min" = 2
"max" = 2
}
}
variable "web_asg_health_check_type" {
type = string
description = "health check type"
default = "ELB"
}
variable "health_check_grace_period" {
type = number
description = "Time (in seconds) after instance comes into service before checking health."
default = 600
}
variable "web_asg_scaling_policy" {
type = map(any)
description = "scaling policy"
default = {
"policy_type" = "TargetTrackingScaling"
"metric_type" = "ASGAverageCPUUtilization"
"target_value" = 75.0
}
}
# ALB vars
#----------------------------------------
variable "load_balancer_name" {
type = string
description = "load balancer name"
default = "web-alb"
}
variable "load_balancer_backend_name" {
type = string
description = "load balancer name"
default = "app-alb"
}
variable "load_balancer_external" {
type = bool
description = "Is looad balancer internal facing?"
default = false
}
variable "load_balancer_internal" {
type = bool
description = "Is looad balancer internal facing?"
default = true
}
variable "load_balancer_type" {
type = string
description = "load balancer"
default = "application"
}
# ALB target group vars
#----------------------------------------
variable "web_alb_tg_http" {
type = map(any)
description = "http target group vars"
default = {
"name" = "web-server-tg-http"
"port" = 80
"protocol" = "HTTP"
}
}
variable "web_alb_tg_https" {
type = map(any)
description = "https target group vars"
default = {
"name" = "web-server-tg-https"
"port" = 443
"protocol" = "HTTPS"
}
}
variable "app_nlb_tg_node" {
type = map(any)
description = "http target group vars"
default = {
"name" = "app-tg-node"
"port" = 4000
"protocol" = "TCP"
}
}
# ALB listener vars
#----------------------------------------
variable "web_alb_listener_http" {
type = map(any)
description = "http listener vars"
default = {
"port" = 80
"protocol" = "HTTP"
"action_type" = "forward"
}
}
variable "web_alb_listener_https" {
type = map(any)
description = "https listener vars"
default = {
"port" = 443
"protocol" = "HTTPS"
"action_type" = "forward"
}
}
variable "app_nlb_listener_node" {
type = map(any)
description = "https listener vars"
default = {
"port" = 4000
"protocol" = "TCP"
"action_type" = "forward"
}
}