Skip to content

Commit

Permalink
create varibles for sg rules
Browse files Browse the repository at this point in the history
  • Loading branch information
yadavprakash committed Aug 28, 2023
1 parent a06f9be commit 115d1e3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 10 deletions.
20 changes: 10 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ resource "aws_security_group" "default" {
}

ingress {
from_port = "2049" # NFS
to_port = "2049"
protocol = "tcp"
from_port = var.from_port # NFS
to_port = var.to_port
protocol = var.protocol
security_groups = var.security_groups
}

ingress {
from_port = "2049" # NFS
to_port = "2049"
protocol = "tcp"
from_port = var.from_port # NFS
to_port = var.to_port
protocol = var.protocol
cidr_blocks = var.allow_cidr #tfsec:ignore:aws-vpc-no-public-egress-sgr
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
from_port = var.egress_from_port
to_port = var.egress_to_port
protocol = var.egress_protocol
description = "for all"
cidr_blocks = ["0.0.0.0/0"] #tfsec:ignore:aws-vpc-no-public-egress-sgr
cidr_blocks = var.egress_cidr_blocks #tfsec:ignore:aws-vpc-no-public-egress-sgr
}

tags = module.label.tags
Expand Down
40 changes: 40 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,46 @@ variable "security_groups" {
sensitive = true
description = "Security group IDs to allow access to the EFS"
}
variable "from_port" {
type = number
default = 2049
description = "Security group IDs to allow access to the EFS"
}

variable "to_port" {
type = number
default = 2049
description = "Security group IDs to allow access to the EFS"
}

variable "egress_from_port" {
type = number
default = 0
description = "Security group IDs to allow access to the EFS"
}
variable "egress_to_port" {
type = number
default = 0
description = "Security group IDs to allow access to the EFS"
}

variable "protocol" {
type = string
default = "tcp"
description = "Security group IDs to allow access to the EFS"
}

variable "egress_protocol" {
type = number
default = -1
description = "Security group IDs to allow access to the EFS"
}

variable "egress_cidr_blocks" {
type = list(string)
default = ["0.0.0.0/0"]
description = "Security group IDs to allow access to the EFS"
}

variable "efs_enabled" {
type = bool
Expand Down

0 comments on commit 115d1e3

Please sign in to comment.