Skip to content

Commit

Permalink
fix: w/o of terraform hashicorp/terraform#2376
Browse files Browse the repository at this point in the history
  • Loading branch information
sugdyzhekov committed Nov 26, 2020
1 parent ab55dc7 commit 5a192bd
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions security_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ resource "aws_security_group" "nat" {
description = "Rules for Nat instance"
vpc_id = local.vpc_id
tags = local.tags
}

resource "aws_security_group_rule" "ingress" {
count = length(local.ports)
type = "ingress"
from_port = element(local.ports, count.index)
protocol = "tcp"
to_port = element(local.ports, count.index)
cidr_blocks = local.private_subnet_cidrs
security_group_id = aws_security_group.nat.id
}
dynamic "ingress" {
for_each = local.ports
content {
cidr_blocks = local.private_subnet_cidrs
from_port = ingress.value
protocol = "tcp"
to_port = ingress.value
}
}

resource "aws_security_group_rule" "egress" {
count = length(local.ports)
type = "egress"
from_port = element(local.ports, count.index)
protocol = "tcp"
to_port = element(local.ports, count.index)
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_security_group.nat.id
dynamic "egress" {
for_each = local.ports
content {
cidr_blocks = ["0.0.0.0/0"]
from_port = egress.value
protocol = "tcp"
to_port = egress.value
}
}
}

0 comments on commit 5a192bd

Please sign in to comment.