Skip to content

Commit

Permalink
Merge pull request #49 from ministryofjustice/enable-performance-insi…
Browse files Browse the repository at this point in the history
…ghts

New variable to enable performance insights
  • Loading branch information
Alejandro Garrido Mota authored Mar 11, 2020
2 parents 1ebf1f5 + 0d574ab commit 02a322c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
47 changes: 24 additions & 23 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,30 @@ resource "aws_security_group" "rds-sg" {
}

resource "aws_db_instance" "rds" {
identifier = local.identifier
final_snapshot_identifier = "${local.identifier}-finalsnapshot"
allocated_storage = var.db_allocated_storage
apply_immediately = true
engine = var.db_engine
engine_version = var.db_engine_version
instance_class = var.db_instance_class
name = local.db_name
username = "cp${random_string.username.result}"
password = random_string.password.result
backup_retention_period = var.db_backup_retention_period
storage_type = var.db_iops == 0 ? "gp2" : "io1"
iops = var.db_iops
storage_encrypted = true
db_subnet_group_name = aws_db_subnet_group.db_subnet.name
vpc_security_group_ids = [aws_security_group.rds-sg.id]
kms_key_id = aws_kms_key.kms.arn
multi_az = true
copy_tags_to_snapshot = true
snapshot_identifier = var.snapshot_identifier
allow_major_version_upgrade = var.allow_major_version_upgrade
parameter_group_name = aws_db_parameter_group.custom_parameters.name
ca_cert_identifier = var.ca_cert_identifier
identifier = local.identifier
final_snapshot_identifier = "${local.identifier}-finalsnapshot"
allocated_storage = var.db_allocated_storage
apply_immediately = true
engine = var.db_engine
engine_version = var.db_engine_version
instance_class = var.db_instance_class
name = local.db_name
username = "cp${random_string.username.result}"
password = random_string.password.result
backup_retention_period = var.db_backup_retention_period
storage_type = var.db_iops == 0 ? "gp2" : "io1"
iops = var.db_iops
storage_encrypted = true
db_subnet_group_name = aws_db_subnet_group.db_subnet.name
vpc_security_group_ids = [aws_security_group.rds-sg.id]
kms_key_id = aws_kms_key.kms.arn
multi_az = true
copy_tags_to_snapshot = true
snapshot_identifier = var.snapshot_identifier
allow_major_version_upgrade = var.allow_major_version_upgrade
parameter_group_name = aws_db_parameter_group.custom_parameters.name
ca_cert_identifier = var.ca_cert_identifier
performance_insights_enabled = var.performance_insights_enabled

tags = {
business-unit = var.business-unit
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ variable "db_parameter" {
description = "A list of DB parameters to apply. Note that parameters may differ from a DB family to another"
}

variable "performance_insights_enabled" {
type = bool
description = "Enable performance insights for RDS?"
default = false
}

0 comments on commit 02a322c

Please sign in to comment.