Skip to content

Instantly share code, notes, and snippets.

@rmzi
Created July 21, 2020 17:18
Show Gist options
  • Save rmzi/043c97a6c1258e01003abd9360845846 to your computer and use it in GitHub Desktop.
Save rmzi/043c97a6c1258e01003abd9360845846 to your computer and use it in GitHub Desktop.
Pseudocode for Security Group User Pattern
resource "aws_rds_cluster" "db" {
...
security_group = ""
...
}
resource "aws_security_group" "airflow-db" {
...
}
resource "aws_security_group" "airflow-db-user {
...
}
resource "aws_security_group_rule" "db-user" {
security_group = aws_security_group.airflow-db
source_security_group = aws_security_group.airflow_db_user
port = 5432
}
resource "aws_ecs_service" "api" {
...
security_groups = [
aws_security_group.airflow_db_user.id,
...
...
]
...
}
@rcarroll901
Copy link

This was super helpful. I think I successfully implemented this paradigm in just-city/jc-pipeline-cluster-terraform repo in security_groups.tf if you want to check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment