Skip to content

Commit 6ab4037

Browse files
Allow to skip sg egress rules creation (#40)
1 parent a1af9df commit 6ab4037

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,13 @@ resource "aws_security_group_rule" "redis_ingress_cidr_blocks" {
132132
}
133133

134134
resource "aws_security_group_rule" "redis_egress" {
135+
count = length(var.egress_cidr_blocks) != 0 ? 1 : 0
136+
135137
type = "egress"
136138
from_port = 0
137139
to_port = 0
138140
protocol = "-1"
139-
cidr_blocks = ["0.0.0.0/0"]
141+
cidr_blocks = var.egress_cidr_blocks
140142
security_group_id = aws_security_group.redis.id
141143
}
142144

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ variable "ingress_cidr_blocks" {
3636
default = []
3737
}
3838

39+
variable "egress_cidr_blocks" {
40+
type = list(string)
41+
description = "List of Egress CIDR blocks."
42+
default = ["0.0.0.0/0"]
43+
}
44+
3945
variable "ingress_self" {
4046
type = bool
4147
description = "Specify whether the security group itself will be added as a source to the ingress rule."

0 commit comments

Comments
 (0)