-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpostgres_16.tf
53 lines (47 loc) · 1.58 KB
/
postgres_16.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
locals {
postgresql_16_name = "postgresql-16"
}
module "postgresql_16" {
source = "./modules/ec2"
server_name = local.postgresql_16_name
instance_type = "t3a.medium"
subnet_id = aws_subnet.pmmdemo_private.id
route53_id = aws_route53_zone.demo_local.id
security_groups = [
aws_security_group.default_access.id
]
user_data = templatefile("provision_scripts/postgres_16.yml", {
name = local.postgresql_16_name,
fqdn = "${local.postgresql_16_name}.${aws_route53_zone.demo_local.name}",
local_domain = "${local.environment_name}.local"
pmm_password = random_password.pmm_admin_pass.result,
pmm_server_endpoint = "pmm-server.${aws_route53_zone.demo_local.name}:443"
postgres_pmm_password = random_password.postgresql_16_pmm_password.result,
postgres_sysbench_password = random_password.postgresql_16_sysbench_password.result,
environment_name = local.environment_name
scripts_path = local.scripts_path
})
depends_on = [
module.pmm_server
]
}
resource "random_password" "postgresql_16_pmm_password" {
length = 16
min_lower = 2
min_numeric = 2
min_upper = 4
special = false
}
resource "random_password" "postgresql_16_sysbench_password" {
length = 16
min_lower = 2
min_numeric = 2
min_upper = 4
special = false
}
module "postgresql_16_disk" {
source = "./modules/ebs"
disk_name = "postgresql-16-disk"
disk_size = 256
instance_id = module.postgresql_16.instance_id
}