Skip to content

Commit 41c4534

Browse files
Merge pull request #22 from tryretool/mcramer_rds_fix
rds and rds security group moved to correct vpc
2 parents dd15f18 + 97da9a2 commit 41c4534

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

modules/aws_ecs/main.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ resource "aws_cloudwatch_log_group" "this" {
1616
retention_in_days = var.log_retention_in_days
1717
}
1818

19+
resource "aws_db_subnet_group" "this" {
20+
name = "${var.deployment_name}-retool"
21+
subnet_ids = var.subnet_ids
22+
}
23+
1924
resource "aws_db_instance" "this" {
2025
identifier = "${var.deployment_name}-rds-instance"
2126
allocated_storage = 80
@@ -28,6 +33,7 @@ resource "aws_db_instance" "this" {
2833
port = 5432
2934
publicly_accessible = var.rds_publicly_accessible
3035
vpc_security_group_ids = [aws_security_group.rds.id]
36+
db_subnet_group_name = aws_db_subnet_group.this.id
3137
performance_insights_enabled = var.rds_performance_insights_enabled
3238

3339
skip_final_snapshot = true
@@ -415,4 +421,4 @@ module "temporal" {
415421
launch_type = var.launch_type
416422
container_sg_id = aws_security_group.containers.id
417423
aws_ecs_capacity_provider_name = var.launch_type == "EC2" ? aws_ecs_capacity_provider.this[0].name : null
418-
}
424+
}

modules/aws_ecs/security.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
resource "aws_security_group" "rds" {
22
name = "${var.deployment_name}-rds-security-group"
33
description = "Retool database security group"
4+
vpc_id = var.vpc_id
45

56
ingress {
67
description = "Retool ECS Postgres Inbound"
@@ -105,4 +106,4 @@ resource "aws_vpc_security_group_ingress_rule" "containers_self_ingress" {
105106
description = "Allow self-ingress for inter-container communication"
106107
referenced_security_group_id = aws_security_group.containers.id
107108
ip_protocol = -1
108-
}
109+
}

modules/aws_ecs/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ variable "rds_instance_class" {
113113

114114
variable "rds_publicly_accessible" {
115115
type = bool
116-
default = true
116+
default = false
117117
description = "Whether the RDS instance should be publicly accessible. Defaults to false."
118118
}
119119

0 commit comments

Comments
 (0)