Skip to content

Commit

Permalink
cidrs and vpc is now optional for aurora
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed Sep 12, 2024
1 parent 8746379 commit e0954f5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/aurora/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ resource "aws_security_group" "this" {

vpc_id = var.vpc_id

count = var.vpc_id != "" ? 1 : 0

tags = var.tags
}

resource "aws_security_group_rule" "allow_egress" {
description = "Allow outgoing traffic for the aurora db"

count = length(var.cidr_blocks) > 0 ? 1 : 0

type = "egress"
from_port = 0
to_port = 0
Expand All @@ -92,6 +96,8 @@ resource "aws_security_group_rule" "allow_egress" {
resource "aws_security_group_rule" "allow_ingress" {
description = "Allow incoming traffic for the aurora db for port 5432"

count = length(var.cidr_blocks) > 0 ? 1 : 0

type = "ingress"
from_port = 5432
to_port = 5432
Expand All @@ -102,6 +108,8 @@ resource "aws_security_group_rule" "allow_ingress" {
}

resource "aws_db_subnet_group" "this" {
count = length(var.subnet_ids) > 0 ? 1 : 0

name = var.cluster_name

description = "For Aurora cluster ${var.cluster_name}"
Expand Down

0 comments on commit e0954f5

Please sign in to comment.