Skip to content

Commit 6ebc192

Browse files
Merge pull request #2 from RohitSquareops/patch-1
added replica option and fixes for storage autoscaling
2 parents 809b633 + 3dd5141 commit 6ebc192

File tree

6 files changed

+35
-31
lines changed

6 files changed

+35
-31
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ module "rds-pg" {
3232
environment = "prod"
3333
storage_type = "gp3"
3434
replica_enable = false
35+
replica_count = 1
3536
kms_key_arn = "arn:aws:kms:region:2222222222:key/f8c8d802-a34b"
37+
storage_type = "gp3"
3638
engine_version = "15.2"
3739
instance_class = "db.m5.large"
3840
master_username = "pguser"
@@ -53,7 +55,7 @@ module "rds-pg" {
5355
slack_webhook_url = "https://hooks/xxxxxxxx"
5456
}
5557
```
56-
Refer [examples](https://github.com/squareops/terraform-aws-rds-postgresql/tree/main/examples/complete) for more details.
58+
Refer [examples](https://github.com/squareops/terraform-aws-rds-postgresql/tree/main/examples) for more details.
5759

5860
## IAM Permissions
5961
The required IAM permissions to create resources from this module can be found [here](https://github.com/squareops/terraform-aws-rds-postgresql/blob/main/IAM.md)

examples/complete-psql-replica/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This example will be very useful for users who are new to a module and want to q
2020

2121
| Name | Version |
2222
|------|---------|
23-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.13.1 |
23+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.43.0 |
2424

2525
## Modules
2626

examples/complete-psql-replica/main.tf

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
locals {
22
region = "us-east-2"
3-
environment = "prod"
43
name = "postgresql"
4+
family = "postgres15"
5+
vpc_cidr = "10.20.0.0/16"
6+
environment = "prod"
7+
storage_type = "gp3"
8+
engine_version = "15.2"
9+
instance_class = "db.m5d.large"
10+
replica_enable = true
11+
replica_count = 1
12+
current_identity = data.aws_caller_identity.current.arn
13+
allowed_security_groups = ["sg-0a680afd35"]
514
additional_tags = {
615
Owner = "Organization_Name"
716
Expires = "Never"
817
Department = "Engineering"
918
}
10-
vpc_cidr = "10.20.0.0/16"
11-
family = "postgres15"
12-
engine_version = "15.2"
13-
current_identity = data.aws_caller_identity.current.arn
14-
allowed_security_groups = ["sg-0a680afd35"]
15-
instance_class = "db.m5d.large"
16-
replica_enable = true
17-
replica_count = 1
1819
}
1920

2021
data "aws_caller_identity" "current" {}
@@ -25,10 +26,10 @@ module "kms" {
2526

2627
deletion_window_in_days = 7
2728
description = "Complete key example showing various configurations available"
28-
enable_key_rotation = false
29+
enable_key_rotation = true
2930
is_enabled = true
3031
key_usage = "ENCRYPT_DECRYPT"
31-
multi_region = false
32+
multi_region = true
3233

3334
# Policy
3435
enable_default_policy = true
@@ -82,14 +83,15 @@ module "rds-pg" {
8283
source = "squareops/rds-postgresql/aws"
8384
name = local.name
8485
db_name = "postgres"
85-
multi_az = "true"
8686
family = local.family
87-
replica_enable = local.replica_enable
88-
replica_count = local.replica_count
87+
multi_az = "true"
8988
vpc_id = module.vpc.vpc_id
9089
subnet_ids = module.vpc.database_subnets ## db subnets
9190
environment = local.environment
91+
replica_enable = local.replica_enable
92+
replica_count = local.replica_count
9293
kms_key_arn = module.kms.key_arn
94+
storage_type = local.storage_type
9395
engine_version = local.engine_version
9496
instance_class = local.instance_class
9597
master_username = "pguser"
@@ -101,11 +103,11 @@ module "rds-pg" {
101103
maintenance_window = "Mon:00:00-Mon:03:00"
102104
final_snapshot_identifier_prefix = "final"
103105
major_engine_version = local.engine_version
104-
deletion_protection = false
106+
deletion_protection = true
105107
cloudwatch_metric_alarms_enabled = true
106108
alarm_cpu_threshold_percent = 70
107109
disk_free_storage_space = "10000000" # in bytes
108-
slack_username = ""
109-
slack_channel = ""
110-
slack_webhook_url = ""
110+
slack_username = "Admin"
111+
slack_channel = "postgresql-notification"
112+
slack_webhook_url = "https://hooks/xxxxxxxx"
111113
}

examples/complete/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This example will be very useful for users who are new to a module and want to q
2020

2121
| Name | Version |
2222
|------|---------|
23-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.13.1 |
23+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.43.0 |
2424

2525
## Modules
2626

examples/complete/main.tf

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ locals {
22
region = "us-east-2"
33
name = "postgresql"
44
family = "postgres15"
5+
vpc_cidr = "10.20.0.0/16"
56
environment = "prod"
67
engine_version = "15.2"
78
instance_class = "db.m5d.large"
8-
vpc_cidr = "10.20.0.0/16"
9+
storage_type = "gp3"
10+
current_identity = data.aws_caller_identity.current.arn
911
allowed_security_groups = ["sg-0a680afd35"]
1012
additional_tags = {
1113
Owner = "Organization_Name"
1214
Expires = "Never"
1315
Department = "Engineering"
1416
}
15-
storage_type = "gp3"
16-
current_identity = data.aws_caller_identity.current.arn
1717
}
1818

1919
data "aws_caller_identity" "current" {}
@@ -24,10 +24,10 @@ module "kms" {
2424

2525
deletion_window_in_days = 7
2626
description = "Complete key example showing various configurations available"
27-
enable_key_rotation = false
27+
enable_key_rotation = true
2828
is_enabled = true
2929
key_usage = "ENCRYPT_DECRYPT"
30-
multi_region = false
30+
multi_region = true
3131

3232
# Policy
3333
enable_default_policy = true
@@ -77,7 +77,7 @@ module "kms" {
7777
# Aliases
7878
aliases = ["${local.name}"]
7979

80-
tags = local.additional_aws_tags
80+
tags = local.additional_tags
8181
}
8282

8383

@@ -121,7 +121,7 @@ module "rds-pg" {
121121
cloudwatch_metric_alarms_enabled = true
122122
alarm_cpu_threshold_percent = 70
123123
disk_free_storage_space = "10000000" # in bytes
124-
slack_username = ""
125-
slack_channel = ""
126-
slack_webhook_url = ""
124+
slack_username = "Admin"
125+
slack_channel = "postgresql-notification"
126+
slack_webhook_url = "https://hooks/xxxxxxxx"
127127
}

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module "db" {
2121
subnet_ids = var.subnet_ids
2222
kms_key_id = var.kms_key_arn
2323
instance_class = var.instance_class
24-
storage_type = var.storage_type
24+
storage_type = var.storage_type
2525
engine_version = var.engine_version
2626
allocated_storage = var.allocated_storage
2727
storage_encrypted = var.storage_encrypted

0 commit comments

Comments
 (0)