Commit 578347fe authored by Volodymyr Zahorniak's avatar Volodymyr Zahorniak Committed by GitHub

feat: Add support for performance_insights_kms_key_id (#253)

parent 22e6126d
...@@ -9,7 +9,7 @@ These types of resources are supported: ...@@ -9,7 +9,7 @@ These types of resources are supported:
* [DB Parameter Group](https://www.terraform.io/docs/providers/aws/r/db_parameter_group.html) * [DB Parameter Group](https://www.terraform.io/docs/providers/aws/r/db_parameter_group.html)
* [DB Option Group](https://www.terraform.io/docs/providers/aws/r/db_option_group.html) * [DB Option Group](https://www.terraform.io/docs/providers/aws/r/db_option_group.html)
Root module calls these modules which can also be used separately to create independent resources: Root module calls these modules which can also be used separately to create independent resources:
* [db_instance](https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/modules/db_instance) - creates RDS DB instance * [db_instance](https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/modules/db_instance) - creates RDS DB instance
* [db_subnet_group](https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/modules/db_subnet_group) - creates RDS DB subnet group * [db_subnet_group](https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/modules/db_subnet_group) - creates RDS DB subnet group
...@@ -211,6 +211,7 @@ No resources. ...@@ -211,6 +211,7 @@ No resources.
| parameters | A list of DB parameters (map) to apply | `list(map(string))` | `[]` | no | | parameters | A list of DB parameters (map) to apply | `list(map(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 | | 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 | `bool` | `false` | no | | performance\_insights\_enabled | Specifies whether Performance Insights are enabled | `bool` | `false` | no |
| performance\_insights\_kms\_key\_id | The ARN for the KMS key to encrypt Performance Insights data. | `string` | `null` | no |
| 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 | | 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 |
| port | The port on which the DB accepts connections | `string` | n/a | yes | | port | The port on which the DB accepts connections | `string` | n/a | yes |
| publicly\_accessible | Bool to control if instance is publicly accessible | `bool` | `false` | no | | publicly\_accessible | Bool to control if instance is publicly accessible | `bool` | `false` | no |
......
...@@ -40,13 +40,13 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -40,13 +40,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_directory_service_directory](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/directory_service_directory) | | [aws_directory_service_directory](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/directory_service_directory) |
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/iam_policy_document) | | [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role_policy_attachment) | | [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role) | | [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) |
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -40,9 +40,9 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -40,9 +40,9 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -40,9 +40,9 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -40,9 +40,9 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -40,9 +40,9 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -40,9 +40,9 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -27,7 +27,7 @@ module "db" { ...@@ -27,7 +27,7 @@ module "db" {
identifier = "demodb-postgres" identifier = "demodb-postgres"
engine = "postgres" engine = "postgres"
engine_version = "9.6.9" engine_version = "11.6"
instance_class = "db.t2.large" instance_class = "db.t2.large"
allocated_storage = 5 allocated_storage = 5
storage_encrypted = false storage_encrypted = false
...@@ -62,14 +62,17 @@ module "db" { ...@@ -62,14 +62,17 @@ module "db" {
subnet_ids = data.aws_subnet_ids.all.ids subnet_ids = data.aws_subnet_ids.all.ids
# DB parameter group # DB parameter group
family = "postgres9.6" family = "postgres11"
# DB option group # DB option group
major_engine_version = "9.6" major_engine_version = "11"
# Snapshot name upon DB deletion # Snapshot name upon DB deletion
final_snapshot_identifier = "demodb" final_snapshot_identifier = "demodb"
# Database Deletion Protection # Database Deletion Protection
deletion_protection = false deletion_protection = false
performance_insights_enabled = true
performance_insights_retention_period = 7
} }
...@@ -42,12 +42,12 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -42,12 +42,12 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/iam_policy_document) | | [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role_policy_attachment) | | [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role) | | [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) |
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -41,9 +41,9 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -41,9 +41,9 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -41,9 +41,9 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -41,9 +41,9 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/security_group) | | [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) |
| [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/subnet_ids) | | [aws_subnet_ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) |
| [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/vpc) | | [aws_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) |
## Inputs ## Inputs
......
...@@ -72,10 +72,10 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -72,10 +72,10 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | | Name |
|------| |------|
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/iam_policy_document) | | [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
| [aws_iam_role_policy](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role_policy) | | [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role) | | [aws_iam_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) |
| [random_pet](https://registry.terraform.io/providers/hashicorp/random/3.0/docs/resources/pet) | | [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) |
## Inputs ## Inputs
......
...@@ -100,6 +100,7 @@ module "db_instance" { ...@@ -100,6 +100,7 @@ module "db_instance" {
performance_insights_enabled = var.performance_insights_enabled performance_insights_enabled = var.performance_insights_enabled
performance_insights_retention_period = var.performance_insights_retention_period performance_insights_retention_period = var.performance_insights_retention_period
performance_insights_kms_key_id = var.performance_insights_enabled == true ? var.performance_insights_kms_key_id : null
backup_retention_period = var.backup_retention_period backup_retention_period = var.backup_retention_period
backup_window = var.backup_window backup_window = var.backup_window
...@@ -122,4 +123,3 @@ module "db_instance" { ...@@ -122,4 +123,3 @@ module "db_instance" {
tags = var.tags tags = var.tags
} }
...@@ -22,10 +22,10 @@ No Modules. ...@@ -22,10 +22,10 @@ No Modules.
| Name | | Name |
|------| |------|
| [aws_db_instance](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/db_instance) | | [aws_db_instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance) |
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/data-sources/iam_policy_document) | | [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role_policy_attachment) | | [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/iam_role) | | [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) |
## Inputs ## Inputs
...@@ -70,6 +70,7 @@ No Modules. ...@@ -70,6 +70,7 @@ No Modules.
| parameter\_group\_name | Name of the DB parameter group to associate | `string` | `""` | no | | 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 | | 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 | `bool` | `false` | no | | performance\_insights\_enabled | Specifies whether Performance Insights are enabled | `bool` | `false` | no |
| performance\_insights\_kms\_key\_id | The ARN for the KMS key to encrypt Performance Insights data. | `string` | `null` | no |
| 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 | | 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 |
| port | The port on which the DB accepts connections | `string` | n/a | yes | | port | The port on which the DB accepts connections | `string` | n/a | yes |
| publicly\_accessible | Bool to control if instance is publicly accessible | `bool` | `false` | no | | publicly\_accessible | Bool to control if instance is publicly accessible | `bool` | `false` | no |
......
...@@ -85,6 +85,7 @@ resource "aws_db_instance" "this" { ...@@ -85,6 +85,7 @@ resource "aws_db_instance" "this" {
performance_insights_enabled = var.performance_insights_enabled performance_insights_enabled = var.performance_insights_enabled
performance_insights_retention_period = var.performance_insights_enabled == true ? var.performance_insights_retention_period : null performance_insights_retention_period = var.performance_insights_enabled == true ? var.performance_insights_retention_period : null
performance_insights_kms_key_id = var.performance_insights_enabled == true ? var.performance_insights_kms_key_id : null
backup_retention_period = var.backup_retention_period backup_retention_period = var.backup_retention_period
backup_window = var.backup_window backup_window = var.backup_window
......
...@@ -280,6 +280,12 @@ variable "performance_insights_retention_period" { ...@@ -280,6 +280,12 @@ variable "performance_insights_retention_period" {
default = 7 default = 7
} }
variable "performance_insights_kms_key_id" {
description = "The ARN for the KMS key to encrypt Performance Insights data."
type = string
default = null
}
variable "max_allocated_storage" { variable "max_allocated_storage" {
description = "Specifies the value for Storage Autoscaling" description = "Specifies the value for Storage Autoscaling"
type = number type = number
......
...@@ -22,7 +22,7 @@ No Modules. ...@@ -22,7 +22,7 @@ No Modules.
| Name | | Name |
|------| |------|
| [aws_db_option_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/db_option_group) | | [aws_db_option_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_option_group) |
## Inputs ## Inputs
......
...@@ -22,7 +22,7 @@ No Modules. ...@@ -22,7 +22,7 @@ No Modules.
| Name | | Name |
|------| |------|
| [aws_db_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/db_parameter_group) | | [aws_db_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) |
## Inputs ## Inputs
......
...@@ -22,7 +22,7 @@ No Modules. ...@@ -22,7 +22,7 @@ No Modules.
| Name | | Name |
|------| |------|
| [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/2.49/docs/resources/db_subnet_group) | | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |
## Inputs ## Inputs
......
...@@ -363,6 +363,12 @@ variable "performance_insights_retention_period" { ...@@ -363,6 +363,12 @@ variable "performance_insights_retention_period" {
default = 7 default = 7
} }
variable "performance_insights_kms_key_id" {
description = "The ARN for the KMS key to encrypt Performance Insights data."
type = string
default = null
}
variable "max_allocated_storage" { variable "max_allocated_storage" {
description = "Specifies the value for Storage Autoscaling" description = "Specifies the value for Storage Autoscaling"
type = number type = number
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment