Skip to content

Commit

Permalink
Merge pull request #15 from clouddrove/feature/sgrule
Browse files Browse the repository at this point in the history
sg ingress rule added for vpc_cidr
  • Loading branch information
d4kverma committed Jul 27, 2022
2 parents f038884 + f465bc2 commit 464c262
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ module "efs" {
subnets = module.subnets.public_subnet_id
security_groups = [module.vpc.vpc_default_security_group_id]
efs_backup_policy_enabled = true
allow_cidr = ["10.0.0.0/16"] #vpc_cidr
}
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ resource "aws_security_group" "default" {
security_groups = var.security_groups
}

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

egress {
from_port = 0
to_port = 0
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,10 @@ variable "efs_backup_policy_enabled" {
type = bool
default = true
description = "If `true`, it will turn on automatic backups."
}

variable "allow_cidr" {
type = list(any)
default = []
description = "Provide allowed cidr to efs"
}

0 comments on commit 464c262

Please sign in to comment.