Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Insights (kms key and retention period) for Terraform011 #157

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ module "db" {
| parameters | A list of DB parameters (map) to apply | list | `[]` | no |
| password | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | string | n/a | yes |
| performance\_insights\_enabled | Specifies whether Performance Insights are enabled | string | `"false"` | no |
| performance\_insights\_kms\_key\_id | The ARN for the KMS key to encrypt Performance Insights data. | string | `""` | no |
| performance\_insights\_retention\_period | The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years). | string | "7" | no |
| port | The port on which the DB accepts connections | string | n/a | yes |
| publicly\_accessible | Bool to control if instance is publicly accessible | string | `"false"` | no |
| replicate\_source\_db | Specifies that this resource is a Replicate database, and to use this value as the source database. This correlates to the identifier of another Amazon RDS Database to replicate. | string | `""` | no |
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ module "db_instance" {
final_snapshot_identifier = "${var.final_snapshot_identifier}"

performance_insights_enabled = "${var.performance_insights_enabled}"
performance_insights_kms_key_id = "${var.performance_insights_kms_key_id}"
performance_insights_retention_period = "${var.performance_insights_retention_period}"

backup_retention_period = "${var.backup_retention_period}"
backup_window = "${var.backup_window}"
Expand Down
2 changes: 2 additions & 0 deletions modules/db_instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
| parameter\_group\_name | Name of the DB parameter group to associate | string | `""` | no |
| password | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | string | n/a | yes |
| performance\_insights\_enabled | Specifies whether Performance Insights are enabled | string | `"false"` | no |
| performance\_insights\_kms\_key\_id | The ARN for the KMS key to encrypt Performance Insights data. | string | `""` | no |
| performance\_insights\_retention\_period | The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years). | string | "7" | no |
| port | The port on which the DB accepts connections | string | n/a | yes |
| publicly\_accessible | Bool to control if instance is publicly accessible | string | `"false"` | no |
| replicate\_source\_db | Specifies that this resource is a Replicate database, and to use this value as the source database. This correlates to the identifier of another Amazon RDS Database to replicate. | string | `""` | no |
Expand Down
4 changes: 4 additions & 0 deletions modules/db_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ resource "aws_db_instance" "this" {
final_snapshot_identifier = "${var.final_snapshot_identifier}"

performance_insights_enabled = "${var.performance_insights_enabled}"
performance_insights_kms_key_id = "${var.performance_insights_enabled ? var.performance_insights_kms_key_id : ""}"
performance_insights_retention_period = "${var.performance_insights_enabled ? var.performance_insights_retention_period : 0}"

backup_retention_period = "${var.backup_retention_period}"
backup_window = "${var.backup_window}"
Expand Down Expand Up @@ -122,6 +124,8 @@ resource "aws_db_instance" "this_mssql" {
final_snapshot_identifier = "${var.final_snapshot_identifier}"

performance_insights_enabled = "${var.performance_insights_enabled}"
performance_insights_kms_key_id = "${var.performance_insights_enabled ? var.performance_insights_kms_key_id : ""}"
performance_insights_retention_period = "${var.performance_insights_enabled ? var.performance_insights_retention_period : 0}"

backup_retention_period = "${var.backup_retention_period}"
backup_window = "${var.backup_window}"
Expand Down
11 changes: 11 additions & 0 deletions modules/db_instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,14 @@ variable "performance_insights_enabled" {
description = "Specifies whether Performance Insights are enabled"
default = false
}

variable "performance_insights_kms_key_id" {
description = "The ARN for the KMS key to encrypt Performance Insights data."
default = ""
}

variable "performance_insights_retention_period" {
description = "The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years)."
default = 7
}

10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,13 @@ variable "performance_insights_enabled" {
description = "Specifies whether Performance Insights are enabled"
default = false
}

variable "performance_insights_kms_key_id" {
description = "The ARN for the KMS key to encrypt Performance Insights data."
default = ""
}

variable "performance_insights_retention_period" {
description = "The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years)."
default = 7
}