-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathvariables.tf
311 lines (265 loc) · 11.1 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
307
308
309
310
311
#------------------------------------------------------------------------------
# Misc
#------------------------------------------------------------------------------
variable "name_prefix" {
type = string
description = "Name prefix for resources on AWS"
}
variable "tags" {
type = map(string)
default = {}
description = "Resource tags"
}
#------------------------------------------------------------------------------
# AWS REGION
#------------------------------------------------------------------------------
variable "region" {
type = string
description = "AWS Region the infrastructure is hosted in"
}
#------------------------------------------------------------------------------
# AWS Networking
#------------------------------------------------------------------------------
variable "vpc_id" {
type = string
description = "ID of the VPC"
}
variable "public_subnets_ids" {
type = list(string)
description = "List of Public Subnets IDs"
}
variable "private_subnets_ids" {
type = list(string)
description = "List of Private Subnets IDs"
}
variable "lb_enable_cross_zone_load_balancing" {
type = string
default = "true"
description = "Enable cross zone support for LB"
}
variable "lb_http_ports" {
description = "Map containing objects to define listeners behaviour based on type field. If type field is `forward`, include listener_port and the target_group_port. For `redirect` type, include listener port, host, path, port, protocol, query and status_code. For `fixed-response`, include listener_port, content_type, message_body and status_code"
type = map(any)
default = {}
}
variable "lb_https_ports" {
description = "Map containing objects to define listeners behaviour based on type field. If type field is `forward`, include listener_port and the target_group_port. For `redirect` type, include listener port, host, path, port, protocol, query and status_code. For `fixed-response`, include listener_port, content_type, message_body and status_code"
type = map(any)
default = {
default = {
listener_port = 443
target_group_port = 9000
target_group_protocol = "HTTP"
}
}
}
variable "lb_waf_web_acl_arn" {
description = "ARN of a WAFV2 to associate with the ALB"
type = string
default = ""
}
#------------------------------------------------------------------------------
# AWS Database
#------------------------------------------------------------------------------
variable "db_instance_size" {
type = string
default = "db.r4.large"
description = "DB instance size"
}
variable "db_name" {
type = string
default = "sonar"
description = "Default DB name"
}
variable "db_username" {
type = string
default = "sonar"
description = "Default DB username"
}
variable "db_password" {
type = string
default = ""
description = "DB password"
}
variable "db_deletion_protection" {
description = "If the DB instance should have deletion protection enabled. The database can't be deleted when this value is set to true. The default is false."
type = bool
default = false
}
variable "db_backup_retention_period" {
description = "The days to retain backups for. Default 3"
type = number
default = 3
}
#------------------------------------------------------------------------------
# CloudWatch logs
#------------------------------------------------------------------------------
variable "create_kms_key" {
description = "If true a new KMS key will be created to encrypt the logs. Defaults true. If set to false a custom key can be used by setting the variable `log_group_kms_key_id`"
type = bool
default = false
}
variable "log_group_kms_key_id" {
description = "The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested."
type = string
default = null
}
variable "log_group_retention_in_days" {
description = "(Optional) Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the log group are always retained and never expire. Default to 30 days."
type = number
default = 30
}
#------------------------------------------------------------------------------
# APPLICATION LOAD BALANCER LOGS
#------------------------------------------------------------------------------
variable "custom_lb_arn" {
description = "ARN of the Load Balancer to use in the ECS service. If provided, this module will not create a load balancer and will use the one provided in this variable"
type = string
default = null
}
variable "enable_s3_logs" {
description = "(Optional) If true, all resources to send LB logs to S3 will be created"
type = bool
default = true
}
variable "block_s3_bucket_public_access" {
description = "(Optional) If true, public access to the S3 bucket will be blocked."
type = bool
default = true
}
variable "enable_s3_bucket_server_side_encryption" {
description = "(Optional) If true, server side encryption will be applied."
type = bool
default = true
}
variable "s3_bucket_server_side_encryption_sse_algorithm" {
description = "(Optional) The server-side encryption algorithm to use. Valid values are AES256 and aws:kms"
type = string
default = "AES256"
}
variable "s3_bucket_server_side_encryption_key" {
description = "(Optional) The AWS KMS master key ID used for the SSE-KMS encryption. This can only be used when you set the value of sse_algorithm as aws:kms. The default aws/s3 AWS KMS master key is used if this element is absent while the sse_algorithm is aws:kms."
type = string
default = null
}
#------------------------------------------------------------------------------
# AWS RDS settings
#------------------------------------------------------------------------------
variable "db_engine_version" {
type = string
default = "14.4"
description = "DB engine version"
}
variable "db_instance_number" {
description = "Number of instance deployed on Aurora. By default, number of subnet in private_subnets_ids"
type = number
default = null
}
#------------------------------------------------------------------------------
# Sonarqube image version
#------------------------------------------------------------------------------
variable "sonarqube_image" {
description = "Sonarqube image"
type = string
default = "sonarqube:lts"
}
variable "enable_autoscaling" {
type = bool
default = false
description = "Enable auto scaling for datacenter edition"
}
#------------------------------------------------------------------------------
# Sonarqube storage settings
#------------------------------------------------------------------------------
variable "ephemeral_storage_size" {
type = number
description = "The number of GBs to provision for ephemeral storage on Fargate tasks. Must be greater than or equal to 21 and less than or equal to 200"
default = 0
}
variable "volumes" {
description = "(Optional) A set of volume blocks that containers in your task may use"
type = list(object({
host_path = string
name = string
docker_volume_configuration = list(object({
autoprovision = bool
driver = string
driver_opts = map(string)
labels = map(string)
scope = string
}))
efs_volume_configuration = list(object({
file_system_id = string
root_directory = string
transit_encryption = string
transit_encryption_port = string
authorization_config = list(object({
access_point_id = string
iam = string
}))
}))
}))
default = []
}
variable "mount_points" {
type = list(any)
description = "Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`. The `readOnly` key is optional."
default = []
}
#------------------------------------------------------------------------------
# AWS ECS Container Definition Variables
#------------------------------------------------------------------------------
variable "container_memory" {
type = number
description = "(Optional) The amount of memory (in MiB) to allow the container to use. This is a hard limit, if the container attempts to exceed the container_memory, the container is killed. This field is optional for Fargate launch type and the total amount of container_memory of all containers in a task will need to be lower than the task memory value"
default = 8192 # 8 GB
}
variable "container_memory_reservation" {
type = number
description = "(Optional) The amount of memory (in MiB) to reserve for the container. If container needs to exceed this threshold, it can do so up to the set container_memory hard limit"
default = 4096 # 4 GB
}
variable "container_cpu" {
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
type = number
description = "(Optional) The number of cpu units to reserve for the container. This is optional for tasks using Fargate launch type and the total amount of container_cpu of all containers in a task will need to be lower than the task-level cpu value"
default = 4096 # 4 vCPU
}
variable "permissions_boundary" {
description = "(Optional) The ARN of the policy that is used to set the permissions boundary for the `ecs_task_execution_role` role."
type = string
default = null
}
variable "deployment_circuit_breaker_enabled" {
description = "(Optional) You can enable the deployment circuit breaker to cause a service deployment to transition to a failed state if tasks are persistently failing to reach RUNNING state or are failing healthcheck."
type = bool
default = false
}
variable "deployment_circuit_breaker_rollback" {
description = "(Optional) The optional rollback option causes Amazon ECS to roll back to the last completed deployment upon a deployment failure."
type = bool
default = false
}
#------------------------------------------------------------------------------
# Sonarqube SSL settings
#------------------------------------------------------------------------------
variable "enable_ssl" {
description = "Enable SSL"
type = bool
default = true
}
variable "dns_zone_id" {
description = "Route 53 zone id"
type = string
default = ""
}
variable "https_record_name" {
description = "Route 53 dns name"
type = string
default = ""
}
variable "https_record_domain_name" {
description = "Route 53 domain name"
type = string
default = ""
}