Skip to content

Commit

Permalink
updated security group rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sakruthijupalli committed Mar 16, 2023
1 parent 390d012 commit d8c58b0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
32 changes: 20 additions & 12 deletions terraform-modules/aws/qldb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,28 @@ resource "aws_security_group" "qldb" {
description = "qldb security group"
vpc_id = var.vpc_id

ingress {
description = "TLS from VPC"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
dynamic "ingress" {
for_each = var.ingress_rule
content {
description = ingress.value["description"]
from_port = ingress.value["from_port"]
to_port = ingress.value["to_port"]
protocol = ingress.value["protocol"]
cidr_blocks = ingress.value["cidr_blocks"]
ipv6_cidr_blocks = ingress.value["ipv6_cidr_blocks"]
}
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
dynamic "egress" {
for_each = var.egress_rule
content {
description = egress.value["description"]
from_port = egress.value["from_port"]
to_port = egress.value["to_port"]
protocol = egress.value["protocol"]
cidr_blocks = egress.value["cidr_blocks"]
ipv6_cidr_blocks = egress.value["ipv6_cidr_blocks"]
}
}

tags = var.tags
Expand Down
30 changes: 30 additions & 0 deletions terraform-modules/aws/qldb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,34 @@ variable "vpc_id" {
type = string
default = ""
description = "The vpc ID"
}

variable "ingress_rule" {
type = list(any)
description = "A list of ingress rules"
default = [
{
description = "All ports from internal addresses"
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
ipv6_cidr_blocks = []
},
]
}

variable "egress_rule" {
type = list(any)
description = "A list of egress rules"
default = [
{
description = "All ports from internal addresses"
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
ipv6_cidr_blocks = ["::/0"]
},
]
}

0 comments on commit d8c58b0

Please sign in to comment.