Skip to content

Commit 546c74a

Browse files
authored
feat: Multi-AZ Cluster performance insights (#462)
cluster performance insights
1 parent d3b2c08 commit 546c74a

File tree

19 files changed

+65
-37
lines changed

19 files changed

+65
-37
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ Terraform documentation is generated automatically using [pre-commit hooks](http
224224
| Name | Version |
225225
|------|---------|
226226
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
227-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
227+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
228228

229229
## Providers
230230

231231
| Name | Version |
232232
|------|---------|
233-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
233+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
234234

235235
## Modules
236236

@@ -285,6 +285,9 @@ No modules.
285285
| <a name="input_cloudwatch_log_group_skip_destroy"></a> [cloudwatch\_log\_group\_skip\_destroy](#input\_cloudwatch\_log\_group\_skip\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `null` | no |
286286
| <a name="input_cluster_ca_cert_identifier"></a> [cluster\_ca\_cert\_identifier](#input\_cluster\_ca\_cert\_identifier) | The CA certificate identifier to use for the DB cluster's server certificate. Currently only supported for multi-az DB clusters | `string` | `null` | no |
287287
| <a name="input_cluster_members"></a> [cluster\_members](#input\_cluster\_members) | List of RDS Instances that are a part of this cluster | `list(string)` | `null` | no |
288+
| <a name="input_cluster_performance_insights_enabled"></a> [cluster\_performance\_insights\_enabled](#input\_cluster\_performance\_insights\_enabled) | Valid only for Non-Aurora Multi-AZ DB Clusters. Enables Performance Insights for the RDS Cluster | `bool` | `null` | no |
289+
| <a name="input_cluster_performance_insights_kms_key_id"></a> [cluster\_performance\_insights\_kms\_key\_id](#input\_cluster\_performance\_insights\_kms\_key\_id) | Valid only for Non-Aurora Multi-AZ DB Clusters. Specifies the KMS Key ID to encrypt Performance Insights data. If not specified, the default RDS KMS key will be used (aws/rds) | `string` | `null` | no |
290+
| <a name="input_cluster_performance_insights_retention_period"></a> [cluster\_performance\_insights\_retention\_period](#input\_cluster\_performance\_insights\_retention\_period) | Valid only for Non-Aurora Multi-AZ DB Clusters. Specifies the amount of time to retain performance insights data for. Defaults to 7 days if Performance Insights are enabled. Valid values are 7, month * 31 (where month is a number of months from 1-23), and 731 | `number` | `null` | no |
288291
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of tags to add to only the cluster. Used for AWS Instance Scheduler tagging | `map(string)` | `{}` | no |
289292
| <a name="input_cluster_timeouts"></a> [cluster\_timeouts](#input\_cluster\_timeouts) | Create, update, and delete timeout configurations for the cluster | `map(string)` | `{}` | no |
290293
| <a name="input_cluster_use_name_prefix"></a> [cluster\_use\_name\_prefix](#input\_cluster\_use\_name\_prefix) | Whether to use `name` as a prefix for the cluster | `bool` | `false` | no |

examples/autoscaling/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3030

3131
## Modules
3232

examples/autoscaling/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
}
1010
}

examples/global-cluster/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.2 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
31-
| <a name="provider_aws.secondary"></a> [aws.secondary](#provider\_aws.secondary) | >= 5.60 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
31+
| <a name="provider_aws.secondary"></a> [aws.secondary](#provider\_aws.secondary) | >= 5.61 |
3232
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.2 |
3333

3434
## Modules

examples/global-cluster/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99

1010
random = {

examples/multi-az/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3030

3131
## Modules
3232

examples/multi-az/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module "aurora" {
3838

3939
enabled_cloudwatch_logs_exports = ["postgresql"]
4040

41+
cluster_performance_insights_enabled = true
42+
cluster_performance_insights_retention_period = 31
43+
4144
# Multi-AZ
4245
availability_zones = module.vpc.azs
4346
allocated_storage = 256

examples/multi-az/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
}
1010
}

examples/mysql/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3030

3131
## Modules
3232

examples/mysql/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
}
1010
}

examples/postgresql/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3030

3131
## Modules
3232

examples/postgresql/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
}
1010
}

examples/s3-import/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ Note that this example may create resources which cost money. Run `terraform des
4949
| Name | Version |
5050
|------|---------|
5151
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
52-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
52+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
5353

5454
## Providers
5555

5656
| Name | Version |
5757
|------|---------|
58-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
58+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
5959

6060
## Modules
6161

examples/s3-import/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
}
1010
}

examples/serverless/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.60 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.5 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.60 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.5 |
3232

3333
## Modules

examples/serverless/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

main.tf

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,29 @@ resource "aws_rds_cluster" "this" {
7171
domain_iam_role_name = var.domain_iam_role_name
7272
iam_database_authentication_enabled = var.iam_database_authentication_enabled
7373
# iam_roles has been removed from this resource and instead will be used with aws_rds_cluster_role_association below to avoid conflicts per docs
74-
iops = var.iops
75-
kms_key_id = var.kms_key_id
76-
manage_master_user_password = var.global_cluster_identifier == null && var.manage_master_user_password ? var.manage_master_user_password : null
77-
master_user_secret_kms_key_id = var.global_cluster_identifier == null && var.manage_master_user_password ? var.master_user_secret_kms_key_id : null
78-
master_password = var.is_primary_cluster && !var.manage_master_user_password ? var.master_password : null
79-
master_username = var.is_primary_cluster ? var.master_username : null
80-
network_type = var.network_type
81-
port = local.port
82-
preferred_backup_window = local.is_serverless ? null : var.preferred_backup_window
83-
preferred_maintenance_window = var.preferred_maintenance_window
84-
replication_source_identifier = var.replication_source_identifier
74+
iops = var.iops
75+
kms_key_id = var.kms_key_id
76+
manage_master_user_password = var.global_cluster_identifier == null && var.manage_master_user_password ? var.manage_master_user_password : null
77+
master_user_secret_kms_key_id = var.global_cluster_identifier == null && var.manage_master_user_password ? var.master_user_secret_kms_key_id : null
78+
master_password = var.is_primary_cluster && !var.manage_master_user_password ? var.master_password : null
79+
master_username = var.is_primary_cluster ? var.master_username : null
80+
network_type = var.network_type
81+
performance_insights_enabled = var.cluster_performance_insights_enabled
82+
performance_insights_kms_key_id = var.cluster_performance_insights_kms_key_id
83+
performance_insights_retention_period = var.cluster_performance_insights_retention_period
84+
port = local.port
85+
preferred_backup_window = local.is_serverless ? null : var.preferred_backup_window
86+
preferred_maintenance_window = var.preferred_maintenance_window
87+
replication_source_identifier = var.replication_source_identifier
8588

8689
dynamic "restore_to_point_in_time" {
8790
for_each = length(var.restore_to_point_in_time) > 0 ? [var.restore_to_point_in_time] : []
8891

8992
content {
9093
restore_to_time = try(restore_to_point_in_time.value.restore_to_time, null)
9194
restore_type = try(restore_to_point_in_time.value.restore_type, null)
92-
source_cluster_identifier = restore_to_point_in_time.value.source_cluster_identifier
95+
source_cluster_identifier = try(restore_to_point_in_time.value.source_cluster_identifier, null)
96+
source_cluster_resource_id = try(restore_to_point_in_time.value.source_cluster_resource_id, null)
9397
use_latest_restorable_time = try(restore_to_point_in_time.value.use_latest_restorable_time, null)
9498
}
9599
}

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ variable "cluster_members" {
102102
default = null
103103
}
104104

105+
variable "cluster_performance_insights_enabled" {
106+
description = "Valid only for Non-Aurora Multi-AZ DB Clusters. Enables Performance Insights for the RDS Cluster"
107+
type = bool
108+
default = null
109+
}
110+
111+
variable "cluster_performance_insights_kms_key_id" {
112+
description = "Valid only for Non-Aurora Multi-AZ DB Clusters. Specifies the KMS Key ID to encrypt Performance Insights data. If not specified, the default RDS KMS key will be used (aws/rds)"
113+
type = string
114+
default = null
115+
}
116+
117+
variable "cluster_performance_insights_retention_period" {
118+
description = "Valid only for Non-Aurora Multi-AZ DB Clusters. Specifies the amount of time to retain performance insights data for. Defaults to 7 days if Performance Insights are enabled. Valid values are 7, month * 31 (where month is a number of months from 1-23), and 731"
119+
type = number
120+
default = null
121+
}
122+
105123
variable "copy_tags_to_snapshot" {
106124
description = "Copy all Cluster `tags` to snapshots"
107125
type = bool

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.60"
7+
version = ">= 5.61"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)