From 88b7ec4978518e6b91826ce9a9c07ad467bdf04c Mon Sep 17 00:00:00 2001 From: Dipo Ajayi Date: Tue, 27 Aug 2024 10:54:01 +0100 Subject: [PATCH] add truefoundry db ongress cidr block option --- rds.tf | 3 ++- variables.tf | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rds.tf b/rds.tf index 69e57e8..aeeeef7 100644 --- a/rds.tf +++ b/rds.tf @@ -22,7 +22,8 @@ resource "aws_security_group" "rds" { from_port = local.truefoundry_db_port to_port = local.truefoundry_db_port protocol = "tcp" - security_groups = [var.truefoundry_db_ingress_security_group] + security_groups = var.truefoundry_db_ingress_security_group != "" ? [var.truefoundry_db_ingress_security_group] : [] + cidr_blocks = var.truefoundry_db_ingress_cidr_block != "" ? [var.truefoundry_db_ingress_cidr_block] : [] } egress { diff --git a/variables.tf b/variables.tf index 128c33e..79dd14f 100644 --- a/variables.tf +++ b/variables.tf @@ -56,6 +56,11 @@ variable "truefoundry_db_ingress_security_group" { description = "SG allowed to connect to the database" } +variable "truefoundry_db_ingress_cidr_block" { + type = string + description = "CIDR block allowed to connect to the database" +} + variable "truefoundry_db_subnet_ids" { type = list(string) description = "List of subnets where the RDS database will be deployed"