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

Ensure the tasks have access to the database to make connections if using non-terraform VPC #345

Merged
merged 2 commits into from
Jul 5, 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
9 changes: 7 additions & 2 deletions cloud/aws/modules/ecs_fargate_service/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ output "aws_lb_civiform_lb_arn" {
}

output "aws_security_group_lb_access_sg_id" {
description = "The ID of the security group"
description = "The ID of the LB access security group"
value = aws_security_group.lb_access_sg.id
}

output "aws_security_group_ecs_tasks_access_sg_id" {
description = "The ID of the ECS tasks access security group"
value = aws_security_group.ecs_tasks_sg.id
}

output "aws_ecs_service_name" {
description = "The service name of the aws ecs service."
description = "The name of the AWS ECS service"
value = aws_ecs_service.service.name
}
11 changes: 11 additions & 0 deletions cloud/aws/templates/aws_oidc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ resource "aws_security_group" "rds" {
cidr_blocks = ["${ingress.value}/32"]
}
}

dynamic "ingress" {
for_each = local.enable_managed_vpc ? [] : [1]
# If the VPC is managed outside of terraform, we need to ensure that the tasks have access to the database to make connections
content {
from_port = 5432
to_port = 5432
protocol = "tcp"
security_groups = [module.ecs_fargate_service.aws_security_group_ecs_tasks_access_sg_id]
}
}
}

module "pgadmin" {
Expand Down
Loading