forked from h2ouw8n4/wordpressOnAWS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
efs.tf
37 lines (33 loc) · 854 Bytes
/
efs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
resource "aws_efs_file_system" "this" {
creation_token = "${var.prefix}-${var.environment}"
encrypted = true
tags = {
Name = "${var.prefix}-${var.environment}"
}
}
resource "aws_efs_mount_target" "this" {
count = length(module.vpc.private_subnets)
file_system_id = aws_efs_file_system.this.id
subnet_id = module.vpc.private_subnets[count.index]
security_groups = [
aws_security_group.efs.id
]
}
resource "aws_security_group" "efs" {
name = "${var.prefix}-efs-${var.environment}"
description = "Allow traffic from self"
vpc_id = module.vpc.vpc_id
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 2049
to_port = 2049
protocol = "tcp"
self = true
}
tags = var.tags
}