diff --git a/examples/deploy/terraform/cluster/main.tf b/examples/deploy/terraform/cluster/main.tf index 2f0383e03..07d106962 100644 --- a/examples/deploy/terraform/cluster/main.tf +++ b/examples/deploy/terraform/cluster/main.tf @@ -19,6 +19,7 @@ module "eks" { ssh_key = local.infra.ssh_key node_iam_policies = local.infra.node_iam_policies efs_security_group = local.infra.efs_security_group + rds_security_group = local.infra.rds_security_group eks = var.eks network_info = local.infra.network kms_info = local.kms diff --git a/examples/deploy/terraform/infra.tfvars b/examples/deploy/terraform/infra.tfvars index dfb3fca83..31732a635 100644 --- a/examples/deploy/terraform/infra.tfvars +++ b/examples/deploy/terraform/infra.tfvars @@ -50,6 +50,10 @@ storage = { ecr = { force_destroy_on_deletion = true } + rds = { + enabled = false + deletion_protection = false + } efs = { access_point_path = "/domino" backup_vault = { diff --git a/examples/deploy/terraform/infra/variables.tf b/examples/deploy/terraform/infra/variables.tf index 83a8d25da..367d56024 100644 --- a/examples/deploy/terraform/infra/variables.tf +++ b/examples/deploy/terraform/infra/variables.tf @@ -235,6 +235,14 @@ variable "storage" { ecr = optional(object({ force_destroy_on_deletion = optional(bool, true) }), {}) + rds = optional(object({ + enabled = optional(bool, false) + engine_version = optional(string, "15.4") + instance_class = optional(string, "db.m5.large") + multi_az = optional(bool, true) + allocated_storage = optional(number, 100) + deletion_protection = optional(bool, true) + }), {}), }) default = {} diff --git a/modules/eks/node-group.tf b/modules/eks/node-group.tf index cd0f015aa..bed5852d5 100644 --- a/modules/eks/node-group.tf +++ b/modules/eks/node-group.tf @@ -60,3 +60,14 @@ resource "aws_security_group_rule" "efs" { description = "EFS access" source_security_group_id = aws_security_group.eks_nodes.id } + +resource "aws_security_group_rule" "rds-postgresql" { + count = var.rds_security_group != null ? 1 : 0 + security_group_id = var.rds_security_group + protocol = "tcp" + from_port = 5432 + to_port = 5432 + type = "ingress" + description = "RDS postgresql access" + source_security_group_id = aws_security_group.eks_nodes.id +} diff --git a/modules/eks/variables.tf b/modules/eks/variables.tf index 89bbab0e5..45c313caa 100644 --- a/modules/eks/variables.tf +++ b/modules/eks/variables.tf @@ -89,6 +89,11 @@ variable "efs_security_group" { type = string } +variable "rds_security_group" { + description = "Security Group ID for RDS postgresql" + type = string +} + variable "bastion_info" { description = < 100? */ + + manage_master_user_password = true + username = "postgres" + + publicly_accessible = false + + auto_minor_version_upgrade = true + + deletion_protection = var.storage.rds.deletion_protection + skip_final_snapshot = ! var.storage.rds.deletion_protection + delete_automated_backups = ! var.storage.rds.deletion_protection + final_snapshot_identifier = var.deploy_id +} diff --git a/modules/infra/submodules/storage/variables.tf b/modules/infra/submodules/storage/variables.tf index 9a535c86b..28db3e4b2 100644 --- a/modules/infra/submodules/storage/variables.tf +++ b/modules/infra/submodules/storage/variables.tf @@ -42,6 +42,9 @@ variable "storage" { ecr = { force_destroy_on_deletion = Toogle to allow recursive deletion of all objects in the ECR repositories. if 'false' terraform will NOT be able to delete non-empty repositories. } + rds = { + enabled = "Toggle to enable provisioning RDS server for hosted postgres" + } enable_remote_backup = Enable tagging required for cross-account backups costs_enabled = Determines whether to provision domino cost related infrastructures, ie, long term storage } @@ -66,6 +69,14 @@ variable "storage" { ecr = optional(object({ force_destroy_on_deletion = optional(bool) })) + rds = optional(object({ + enabled = optional(bool, false) + engine_version = optional(string, "15.4") + instance_class = optional(string, "db.m5.large") + multi_az = optional(bool, true) + allocated_storage = optional(number, 100) + deletion_protection = optional(bool, true) + }), {}), enable_remote_backup = optional(bool) costs_enabled = optional(bool) }) diff --git a/modules/infra/variables.tf b/modules/infra/variables.tf index e7d1e44c8..a6455695d 100644 --- a/modules/infra/variables.tf +++ b/modules/infra/variables.tf @@ -349,6 +349,9 @@ variable "storage" { ecr = { force_destroy_on_deletion = Toogle to allow recursive deletion of all objects in the ECR repositories. if 'false' terraform will NOT be able to delete non-empty repositories. } + rds = { + enabled = "Toggle to enable provisioning RDS server for hosted postgres" + } enable_remote_backup = Enable tagging required for cross-account backups costs_enabled = Determines whether to provision domino cost related infrastructures, ie, long term storage } @@ -373,6 +376,14 @@ variable "storage" { ecr = optional(object({ force_destroy_on_deletion = optional(bool, true) }), {}), + rds = optional(object({ + enabled = optional(bool, false) + engine_version = optional(string, "15.4") + instance_class = optional(string, "db.m5.large") + multi_az = optional(bool, true) + allocated_storage = optional(number, 100) + deletion_protection = optional(bool, true) + }), {}), enable_remote_backup = optional(bool, false) costs_enabled = optional(bool, true) })