Skip to content

Commit 3fa3b2f

Browse files
committed
update
1 parent 4912792 commit 3fa3b2f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ resource "aws_security_group_rule" "egress_ipv6" {
7070
#Description : Provides a security group rule resource. Represents a single ingress
7171
# group rule, which can be added to external Security Groups.
7272
resource "aws_security_group_rule" "ingress" {
73-
count = local.enable_cidr_rules == true ? length(compact(var.allowed_ports)) : 0
73+
count = var.enable_security_group == true && local.enable_cidr_rules == true ? length(compact(var.allowed_ports)) : 0
7474

7575
type = "ingress"
7676
from_port = element(var.allowed_ports, count.index)
@@ -80,7 +80,7 @@ resource "aws_security_group_rule" "ingress" {
8080
security_group_id = join("", aws_security_group.default.*.id)
8181
}
8282
resource "aws_security_group_rule" "ingress_ipv6" {
83-
count = local.enable_cidr_rules == true ? length(compact(var.allowed_ports)) : 0
83+
count = var.enable_security_group == true && local.enable_cidr_rules == true ? length(compact(var.allowed_ports)) : 0
8484

8585
type = "ingress"
8686
from_port = element(var.allowed_ports, count.index)
@@ -91,7 +91,7 @@ resource "aws_security_group_rule" "ingress_ipv6" {
9191
}
9292

9393
resource "aws_security_group_rule" "ingress_sg" {
94-
count = local.enable_source_sec_group_rules == true ? length(local.ports_source_sec_group_product) : 0
94+
count = var.enable_security_group == true && local.enable_source_sec_group_rules == true ? length(local.ports_source_sec_group_product) : 0
9595

9696
type = "ingress"
9797
from_port = element(element(local.ports_source_sec_group_product, count.index), 0)

0 commit comments

Comments
 (0)