Skip to content

Commit

Permalink
Merge pull request #223 from tablexi/rds-perf-insights
Browse files Browse the repository at this point in the history
adding rds performance insights option
  • Loading branch information
als753 authored Nov 9, 2022
2 parents 1c3a900 + 22c47ac commit 0994697
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: hashicorp/terraform:0.14.7
image: hashicorp/terraform:1.0.10

steps:
- uses: actions/checkout@v1
Expand Down
1 change: 1 addition & 0 deletions aws/database_replica/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "aws_db_instance" "mod" {
identifier = var.identifier != "" ? var.identifier : "${var.name}-${var.env}-${local.engine}"
instance_class = var.node_type
iops = var.iops
max_allocated_storage = var.max_allocated_storage
monitoring_interval = var.monitoring_interval
monitoring_role_arn = var.monitoring_interval == 0 ? "" : aws_iam_role.rds_enhanced_monitoring[0].arn
multi_az = var.multi_az
Expand Down
7 changes: 6 additions & 1 deletion aws/database_replica/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ variable "iops" {
default = 0
}

variable "max_allocated_storage" {
description = "To enable storage autoscaling, you need to set this value to the upper limit of storage that RDS can automatically scale to. Must be greater then or equal to allocated_storage value."
default = 0
type = number
}

variable "multi_az" {
description = "AWS RDS automatically creates a primary DB Instance and synchronously replicates the data to a standby instance in a different Availability Zone."
default = false
Expand Down Expand Up @@ -91,4 +97,3 @@ variable "vpc_security_group_ids" {
type = list(string)
default = []
}

53 changes: 27 additions & 26 deletions aws/rds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,33 @@ resource "aws_db_subnet_group" "mod" {
}

resource "aws_db_instance" "mod" {
allocated_storage = var.storage
allow_major_version_upgrade = true
apply_immediately = true
auto_minor_version_upgrade = var.auto_minor_version_upgrade
backup_retention_period = var.backup_retention_period
db_subnet_group_name = var.source_db == "" ? local.subnet_group_name : ""
engine = var.engine
engine_version = var.engine_version
final_snapshot_identifier = "${var.name}-${var.env}-${var.engine}-final-snapshot"
identifier = var.identifier != "" ? var.identifier : "${var.name}-${var.env}-${var.engine}"
iops = var.iops
instance_class = var.node_type
kms_key_id = var.kms_key_id
max_allocated_storage = var.max_allocated_storage
monitoring_interval = var.monitoring_interval
monitoring_role_arn = var.monitoring_interval == 0 ? "" : aws_iam_role.rds_enhanced_monitoring[0].arn
multi_az = var.multi_az
parameter_group_name = local.parameter_group_name
password = "nopassword"
publicly_accessible = var.publicly_accessible
replicate_source_db = var.source_db
skip_final_snapshot = var.skip_final_snapshot
storage_encrypted = var.storage_encrypted
storage_type = var.storage_type
tags = var.tags
username = var.username != "" ? var.username : "${var.name}${var.username_suffix}"
allocated_storage = var.storage
allow_major_version_upgrade = true
apply_immediately = true
auto_minor_version_upgrade = var.auto_minor_version_upgrade
backup_retention_period = var.backup_retention_period
db_subnet_group_name = var.source_db == "" ? local.subnet_group_name : ""
engine = var.engine
engine_version = var.engine_version
final_snapshot_identifier = "${var.name}-${var.env}-${var.engine}-final-snapshot"
identifier = var.identifier != "" ? var.identifier : "${var.name}-${var.env}-${var.engine}"
iops = var.iops
instance_class = var.node_type
kms_key_id = var.kms_key_id
max_allocated_storage = var.max_allocated_storage
monitoring_interval = var.monitoring_interval
monitoring_role_arn = var.monitoring_interval == 0 ? "" : aws_iam_role.rds_enhanced_monitoring[0].arn
multi_az = var.multi_az
parameter_group_name = local.parameter_group_name
password = "nopassword"
performance_insights_enabled = var.performance_insights_enabled
publicly_accessible = var.publicly_accessible
replicate_source_db = var.source_db
skip_final_snapshot = var.skip_final_snapshot
storage_encrypted = var.storage_encrypted
storage_type = var.storage_type
tags = var.tags
username = var.username != "" ? var.username : "${var.name}${var.username_suffix}"
vpc_security_group_ids = concat(
var.vpc_security_group_ids,
Expand Down
5 changes: 5 additions & 0 deletions aws/rds/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ variable "parameter_group_name" {
default = ""
}

variable "performance_insights_enabled" {
description = "Specifies whether Performance Insights are enabled. Defaults to false."
default = false
}

variable "publicly_accessible" {
description = "Bool to control if instance is publicly accessible."
default = true
Expand Down

0 comments on commit 0994697

Please sign in to comment.