Skip to content

Commit fb45027

Browse files
authored
Merge pull request #30 from souza-dan/rds-features
DEV-15188 DEV-15189 - Makes performance insights and multi AZ configurable
2 parents a2da238 + 257e998 commit fb45027

File tree

8 files changed

+41
-3
lines changed

8 files changed

+41
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Tamr Terraform Template Repo
22

3+
## v4.1.0 - September 1st 2022
4+
* Adds support for configuring multiple AZs
5+
* Adds support for configuring performance insights
6+
37
## v4.0.1 - August 4th 2022
48
* Adjusts AWS provider constraints to allow newer versions
59

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,13 @@ This terraform module will create:
6666
| instance\_class | Instance class | `string` | `"db.m4.large"` | no |
6767
| maintenance\_window | Maintenance window | `string` | `"sun:04:32-sun:05:02"` | no |
6868
| max\_allocated\_storage | Max allocate storage | `number` | `1000` | no |
69+
| multi\_az | Specifies if the RDS instance is multi-AZ. | `bool` | `true` | no |
6970
| param\_log\_min\_duration\_statement | (ms) Sets the minimum execution time above which statements will be logged. | `string` | `"-1"` | no |
7071
| param\_log\_statement | Sets the type of statements logged. Valid values are none, ddl, mod, all | `string` | `"none"` | no |
7172
| parameter\_group\_family | The family of the DB parameter group | `string` | `"postgres12"` | no |
7273
| parameter\_group\_name | The name of the rds parameter group | `string` | `"rds-postgres-pg"` | no |
74+
| performance\_insights\_enabled | Specifies whether Performance Insights are enabled. | `bool` | `false` | no |
75+
| performance\_insights\_retention\_period | The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years). | `number` | `7` | no |
7376
| postgres\_name | The name of the postgres database to create on the DB instance | `string` | `"tamr_rds_db"` | no |
7477
| skip\_final\_snapshot | Skip final snapshot | `bool` | `true` | no |
7578
| storage\_type | Storage type (e.g. gp2, io1) | `string` | `"gp2"` | no |

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.1
1+
4.1.0

examples/minimal/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ No provider.
1616
| subnet\_ids | List of at least 2 subnets in different AZs for DB subnet group | `list(string)` | n/a | yes |
1717
| vpc\_id | VPC ID of network. | `string` | n/a | yes |
1818
| egress\_cidr\_blocks | CIDR blocks to attach to security groups for egress | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
19+
| multi\_az | Specifies if the RDS instance is multi-AZ. | `bool` | `true` | no |
1920
| tags | A map of tags to add to all resources created by this example. | `map(string)` | <pre>{<br> "Author": "Tamr",<br> "Environment": "Example"<br>}</pre> | no |
2021

2122
## Outputs

examples/minimal/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "rds_postgres" {
2-
# source = "git::https://github.com/Datatamer/terraform-aws-rds-postgres.git?ref=3.0.0"
2+
# source = "git::https://github.com/Datatamer/terraform-aws-rds-postgres.git?ref=4.1.0"
33
source = "../.."
44

55
identifier_prefix = "${var.name_prefix}-example-rds-pg-"
@@ -11,6 +11,7 @@ module "rds_postgres" {
1111
subnet_group_name = "${var.name_prefix}_example_subnet_group"
1212
# Network requirement: DB subnet group needs a subnet in at least two Availability Zones
1313
rds_subnet_ids = var.subnet_ids
14+
multi_az = var.multi_az
1415
security_group_ids = module.rds-postgres-sg.security_group_ids
1516
tags = var.tags
1617
}

examples/minimal/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ variable "subnet_ids" {
88
description = "List of at least 2 subnets in different AZs for DB subnet group"
99
}
1010

11+
variable "multi_az" {
12+
default = true
13+
type = bool
14+
description = "Specifies if the RDS instance is multi-AZ."
15+
}
16+
1117
variable "name_prefix" {
1218
description = "A string to prepend to names of resources created by this example"
1319
}

main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ resource "aws_db_subnet_group" "rds_postgres_subnet_group" {
2929
}
3030

3131
resource "aws_db_instance" "rds_postgres" {
32+
# 'name' is deprecated in favor of 'db_name' after provider version 4.0.0
3233
name = var.postgres_name
3334

3435
identifier_prefix = var.identifier_prefix
@@ -47,7 +48,7 @@ resource "aws_db_instance" "rds_postgres" {
4748
port = var.db_port
4849

4950
db_subnet_group_name = aws_db_subnet_group.rds_postgres_subnet_group.name
50-
multi_az = true
51+
multi_az = var.multi_az
5152
publicly_accessible = false
5253
vpc_security_group_ids = var.security_group_ids
5354
parameter_group_name = aws_db_parameter_group.rds_postgres_pg.name
@@ -64,6 +65,10 @@ resource "aws_db_instance" "rds_postgres" {
6465
copy_tags_to_snapshot = var.copy_tags_to_snapshot
6566
tags = local.effective_tags
6667

68+
# Performance Insights
69+
performance_insights_enabled = var.performance_insights_enabled
70+
performance_insights_retention_period = var.performance_insights_enabled ? var.performance_insights_retention_period : null
71+
6772
lifecycle {
6873
ignore_changes = [password]
6974
}

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,21 @@ variable "enabled_cloudwatch_logs_exports" {
155155
type = bool
156156
description = "Indicates that postgresql logs will be configured to be sent automatically to Cloudwatch"
157157
}
158+
159+
variable "multi_az" {
160+
default = true
161+
type = bool
162+
description = "Specifies if the RDS instance is multi-AZ."
163+
}
164+
165+
variable "performance_insights_enabled" {
166+
default = false
167+
type = bool
168+
description = "Specifies whether Performance Insights are enabled."
169+
}
170+
171+
variable "performance_insights_retention_period" {
172+
default = 7
173+
type = number
174+
description = "The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years)."
175+
}

0 commit comments

Comments
 (0)