-
Notifications
You must be signed in to change notification settings - Fork 1
/
efs.tf
26 lines (23 loc) · 772 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
# Create Elastic File System and Mount Targets
resource "aws_efs_file_system" "demoWP" {
tags {
Name = "Demo WP"
}
}
resource "aws_efs_mount_target" "demoWP" {
count = 2
file_system_id = "${aws_efs_file_system.demoWP.id}"
subnet_id = "${element("${aws_subnet.private.*.id}", count.index)}"
security_groups = ["${aws_security_group.nfsIngressSg.id}"]
}
resource "aws_security_group" "nfsIngressSg" {
name = "efs-mount-target-NFS"
description = "Allow NFS port 2049 ingress"
vpc_id = "${aws_vpc.wordpressVpc.id}"
ingress {
from_port = 2049
to_port = 2049
protocol = "tcp"
self = true # This will allow ingress between the ec2 instances and mount targets when this sg is attached to both
}
}