-
Notifications
You must be signed in to change notification settings - Fork 17
/
README.yaml
365 lines (328 loc) · 10.5 KB
/
README.yaml
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name : Terraform AWS Aurora
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-aurora
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-aurora.svg"
url: "https://github.com/clouddrove/terraform-aws-aurora/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-aurora/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-aurora/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.6.6"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.31.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
Terraform module which creates RDS Aurora database resources on AWS and can create different type of databases. Currently it supports Postgres and MySQL.
# How to use this project
usage : |-
Here are some examples of how you can use this module in your inventory structure:
### Aurora MySQL
```hcl
module "aurora" {
source = "clouddrove/aurora/aws"
version = "1.3.0"
name = "mysql"
environment = "test"
engine = "aurora-mysql"
engine_version = "8.0"
master_username = "root"
database_name = "test-db"
sg_ids = []
allowed_ports = [3306]
allowed_ip = [module.vpc.vpc_cidr_block, "0.0.0.0/0"]
instances = {
1 = {
instance_class = "db.r5.large"
publicly_accessible = true
}
2 = {
identifier = "mysql-static-1"
instance_class = "db.r5.2xlarge"
}
3 = {
identifier = "mysql-excluded-1"
instance_class = "db.r5.xlarge"
promotion_tier = 15
}
}
vpc_id = module.vpc.vpc_id
db_subnet_group_name = "mysql-aurora"
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.subnets.public_subnet_id
}
}
apply_immediately = true
skip_final_snapshot = true
subnets = module.subnets.public_subnet_id
create_db_cluster_parameter_group = true
db_cluster_parameter_group_name = "aurora-mysql"
db_cluster_parameter_group_family = "aurora-mysql8.0"
db_cluster_parameter_group_description = "mysql aurora example cluster parameter group"
db_cluster_parameter_group_parameters = [
{
name = "connect_timeout"
value = 120
apply_method = "immediate"
}, {
name = "innodb_lock_wait_timeout"
value = 300
apply_method = "immediate"
}, {
name = "log_output"
value = "FILE"
apply_method = "immediate"
}, {
name = "max_allowed_packet"
value = "67108864"
apply_method = "immediate"
}, {
name = "aurora_parallel_query"
value = "OFF"
apply_method = "pending-reboot"
}, {
name = "binlog_format"
value = "ROW"
apply_method = "pending-reboot"
}, {
name = "log_bin_trust_function_creators"
value = 1
apply_method = "immediate"
}, {
name = "require_secure_transport"
value = "ON"
apply_method = "immediate"
}, {
name = "tls_version"
value = "TLSv1.2"
apply_method = "pending-reboot"
}
]
create_db_parameter_group = true
db_parameter_group_name = "aurora-mysql"
db_parameter_group_family = "aurora-mysql8.0"
db_parameter_group_description = "mysql aurora example DB parameter group"
db_parameter_group_parameters = [
{
name = "connect_timeout"
value = 60
apply_method = "immediate"
}, {
name = "general_log"
value = 0
apply_method = "immediate"
}, {
name = "innodb_lock_wait_timeout"
value = 300
apply_method = "immediate"
}, {
name = "log_output"
value = "FILE"
apply_method = "pending-reboot"
}, {
name = "long_query_time"
value = 5
apply_method = "immediate"
}, {
name = "max_connections"
value = 2000
apply_method = "immediate"
}, {
name = "slow_query_log"
value = 1
apply_method = "immediate"
}, {
name = "log_bin_trust_function_creators"
value = 1
apply_method = "immediate"
}
]
enabled_cloudwatch_logs_exports = ["audit", "error", "general", "slowquery"]
}
```
### Aurora Postgres
```hcl
module "postgres" {
source = "clouddrove/aurora/aws"
name = "postgresql"
environment = "test"
engine = "aurora-postgresql"
engine_version = "14.7"
master_username = "root"
storage_type = "aurora-iopt1"
sg_ids = []
allowed_ports = [5432]
subnets = module.public_subnets.public_subnet_id
allowed_ip = [module.vpc.vpc_cidr_block, "0.0.0.0/0"]
instances = {
1 = {
instance_class = "db.r5.2xlarge"
publicly_accessible = true
}
2 = {
identifier = "static-member-1"
instance_class = "db.r5.2xlarge"
}
3 = {
identifier = "excluded-member-1"
instance_class = "db.r5.large"
promotion_tier = 15
}
}
endpoints = {
static = {
identifier = "static-custom-endpt"
type = "ANY"
static_members = ["static-member-1"]
tags = { Endpoint = "static-members" }
}
excluded = {
identifier = "excluded-custom-endpt"
type = "READER"
excluded_members = ["excluded-member-1"]
tags = { Endpoint = "excluded-members" }
}
}
vpc_id = module.vpc.vpc_id
db_subnet_group_name = "aurora-postgre"
database_name = "postgres"
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.public_subnets.public_subnet_id
}
egress_example = {
cidr_blocks = ["10.33.0.0/28"]
description = "Egress to corporate printer closet"
}
}
apply_immediately = true
skip_final_snapshot = true
create_db_cluster_parameter_group = true
db_cluster_parameter_group_name = "aurora-postgre"
db_cluster_parameter_group_family = "aurora-postgresql14"
db_cluster_parameter_group_description = "aurora postgres example cluster parameter group"
db_cluster_parameter_group_parameters = [
{
name = "log_min_duration_statement"
value = 4000
apply_method = "immediate"
}, {
name = "rds.force_ssl"
value = 1
apply_method = "immediate"
}
]
create_db_parameter_group = true
db_parameter_group_name = "aurora-postgre"
db_parameter_group_family = "aurora-postgresql14"
db_parameter_group_description = "postgres aurora example DB parameter group"
db_parameter_group_parameters = [
{
name = "log_min_duration_statement"
value = 4000
apply_method = "immediate"
}
]
enabled_cloudwatch_logs_exports = ["postgresql"]
create_cloudwatch_log_group = true
}
```
### Aurora Serverless MySQL
```hcl
module "aurora" {
source = "clouddrove/aurora/aws"
version = "1.3.0"
name = "mysql"
environment = "test"
engine = "aurora-mysql"
engine_mode = "provisioned"
engine_version = "8.0"
master_username = "root"
database_name = "test-db"
sg_ids = []
allowed_ports = [3306]
allowed_ip = [module.vpc.vpc_cidr_block, "0.0.0.0/0"]
vpc_id = module.vpc.vpc_id
db_subnet_group_name = "mysql-aurora-serverless"
subnets = module.subnets.public_subnet_id
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.subnets.public_subnet_id
}
}
monitoring_interval = 60
apply_immediately = true
skip_final_snapshot = true
serverlessv2_scaling_configuration = {
min_capacity = 2
max_capacity = 10
}
instance_class = "db.serverless"
instances = {
one = {}
two = {}
}
}
```
### Aurora Serverless Postgres
```hcl
module "postgres" {
source = "clouddrove/aurora/aws"
version = "1.3.0"
name = "postgresql"
environment = "test"
engine = "aurora-postgresql"
engine_mode = "provisioned"
engine_version = "14.5"
master_username = "root"
database_name = "postgres"
vpc_id = module.vpc.vpc_id
subnets = module.subnets.public_subnet_id
sg_ids = []
allowed_ports = [5432]
db_subnet_group_name = "auror-postgres-serverless"
allowed_ip = [module.vpc.vpc_cidr_block, "0.0.0.0/0"]
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.subnets.public_subnet_id
}
}
monitoring_interval = 60
apply_immediately = true
skip_final_snapshot = true
serverlessv2_scaling_configuration = {
min_capacity = 2
max_capacity = 10
}
instance_class = "db.serverless"
instances = {
one = {}
two = {}
}
}
```