Skip to content

Commit 464c262

Browse files
authored
Merge pull request #15 from clouddrove/feature/sgrule
sg ingress rule added for vpc_cidr
2 parents f038884 + f465bc2 commit 464c262

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

_example/example.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ module "efs" {
4242
subnets = module.subnets.public_subnet_id
4343
security_groups = [module.vpc.vpc_default_security_group_id]
4444
efs_backup_policy_enabled = true
45+
allow_cidr = ["10.0.0.0/16"] #vpc_cidr
4546
}

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ resource "aws_security_group" "default" {
5959
security_groups = var.security_groups
6060
}
6161

62+
ingress {
63+
from_port = "2049" # NFS
64+
to_port = "2049"
65+
protocol = "tcp"
66+
cidr_blocks = var.allow_cidr #tfsec:ignore:aws-vpc-no-public-egress-sgr
67+
}
68+
6269
egress {
6370
from_port = 0
6471
to_port = 0

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,10 @@ variable "efs_backup_policy_enabled" {
140140
type = bool
141141
default = true
142142
description = "If `true`, it will turn on automatic backups."
143+
}
144+
145+
variable "allow_cidr" {
146+
type = list(any)
147+
default = []
148+
description = "Provide allowed cidr to efs"
143149
}

0 commit comments

Comments
 (0)