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

Added option for performance insights #9

Merged
merged 2 commits into from
Feb 2, 2024
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Truefoundry AWS Control Plane Module
| <a name="input_truefoundry_artifact_buckets_will_read"></a> [truefoundry\_artifact\_buckets\_will\_read](#input\_truefoundry\_artifact\_buckets\_will\_read) | A list of bucket IDs mlfoundry will need read access to, in order to show the stored artifacts. It accepts any valid IAM resource, including ARNs with wildcards, so you can do something like arn:aws:s3:::bucket-prefix-* | `list(string)` | `[]` | no |
| <a name="input_truefoundry_db_allocated_storage"></a> [truefoundry\_db\_allocated\_storage](#input\_truefoundry\_db\_allocated\_storage) | Storage for RDS. Minimum storage allowed for gp3 volumes is 20GB | `string` | `"20"` | no |
| <a name="input_truefoundry_db_deletion_protection"></a> [truefoundry\_db\_deletion\_protection](#input\_truefoundry\_db\_deletion\_protection) | n/a | `bool` | `true` | no |
| <a name="input_truefoundry_db_enable_insights"></a> [truefoundry\_db\_enable\_insights](#input\_truefoundry\_db\_enable\_insights) | Enable insights to truefoundry db | `bool` | `false` | no |
| <a name="input_truefoundry_db_enable_override"></a> [truefoundry\_db\_enable\_override](#input\_truefoundry\_db\_enable\_override) | Enable override for truefoundry db name. You must pass truefoundry\_db\_override\_name | `bool` | `false` | no |
| <a name="input_truefoundry_db_engine_version"></a> [truefoundry\_db\_engine\_version](#input\_truefoundry\_db\_engine\_version) | Truefoundry DB Postgres version | `string` | `"13.10"` | no |
| <a name="input_truefoundry_db_ingress_security_group"></a> [truefoundry\_db\_ingress\_security\_group](#input\_truefoundry\_db\_ingress\_security\_group) | SG allowed to connect to the database | `string` | n/a | yes |
Expand Down
50 changes: 26 additions & 24 deletions rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,30 @@ resource "aws_security_group" "rds-public" {
}

resource "aws_db_instance" "truefoundry_db" {
tags = local.tags
engine = "postgres"
engine_version = var.truefoundry_db_engine_version
multi_az = var.truefoundry_db_multiple_az
allocated_storage = var.truefoundry_db_allocated_storage
max_allocated_storage = var.truefoundry_db_max_allocated_storage
port = local.truefoundry_db_port
db_subnet_group_name = aws_db_subnet_group.rds.name
vpc_security_group_ids = concat([aws_security_group.rds.id], aws_security_group.rds-public[*].id)
username = local.truefoundry_db_master_username
identifier = var.truefoundry_db_enable_override ? var.truefoundry_db_override_name : null
identifier_prefix = var.truefoundry_db_enable_override ? null : local.truefoundry_db_unique_name
db_name = local.truefoundry_db_database_name
skip_final_snapshot = var.truefoundry_db_skip_final_snapshot
password = random_password.truefoundry_db_password.result
backup_retention_period = 14
instance_class = var.truefoundry_db_instance_class
publicly_accessible = var.truefoundry_db_publicly_accessible
deletion_protection = var.truefoundry_db_deletion_protection
apply_immediately = true
storage_encrypted = var.truefoundry_db_storage_encrypted
enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
storage_type = var.truefoundry_db_storage_type
iops = var.truefoundry_db_storage_iops == 0 ? null : var.truefoundry_db_storage_iops
tags = local.tags
engine = "postgres"
engine_version = var.truefoundry_db_engine_version
multi_az = var.truefoundry_db_multiple_az
allocated_storage = var.truefoundry_db_allocated_storage
max_allocated_storage = var.truefoundry_db_max_allocated_storage
port = local.truefoundry_db_port
db_subnet_group_name = aws_db_subnet_group.rds.name
vpc_security_group_ids = concat([aws_security_group.rds.id], aws_security_group.rds-public[*].id)
username = local.truefoundry_db_master_username
identifier = var.truefoundry_db_enable_override ? var.truefoundry_db_override_name : null
identifier_prefix = var.truefoundry_db_enable_override ? null : local.truefoundry_db_unique_name
db_name = local.truefoundry_db_database_name
skip_final_snapshot = var.truefoundry_db_skip_final_snapshot
password = random_password.truefoundry_db_password.result
backup_retention_period = 14
instance_class = var.truefoundry_db_instance_class
performance_insights_enabled = var.truefoundry_db_enable_insights
performance_insights_retention_period = var.truefoundry_db_enable_insights ? 31 : 0
publicly_accessible = var.truefoundry_db_publicly_accessible
deletion_protection = var.truefoundry_db_deletion_protection
apply_immediately = true
storage_encrypted = var.truefoundry_db_storage_encrypted
enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
storage_type = var.truefoundry_db_storage_type
iops = var.truefoundry_db_storage_iops == 0 ? null : var.truefoundry_db_storage_iops
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ variable "truefoundry_db_override_name" {
}
}

variable "truefoundry_db_enable_insights" {
description = "Enable insights to truefoundry db"
type = bool
default = false
}

variable "truefoundry_db_multiple_az" {
description = "Enable Multi-az (standby) instances for RDS instances"
type = bool
Expand Down