-
Notifications
You must be signed in to change notification settings - Fork 0
/
efs.tf
43 lines (35 loc) · 1022 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
38
39
40
41
42
43
resource "aws_efs_file_system" "default" {
creation_token = var.name
encrypted = true
tags = {
Name = "efs-${var.name}"
}
}
resource "aws_efs_mount_target" "default" {
count = length(var.secure_subnet_ids)
file_system_id = aws_efs_file_system.default.id
subnet_id = var.secure_subnet_ids[count.index]
security_groups = [
aws_security_group.efs.id,
]
lifecycle {
ignore_changes = [subnet_id]
}
}
resource "aws_security_group" "efs" {
name = "efs-${var.name}"
description = "for EFS to talk to default cluster"
vpc_id = var.vpc_id
tags = {
Name = "efs-${var.name}"
}
}
resource "aws_security_group_rule" "nfs_from_node_to_efs" {
description = "${var.name} to EFS"
type = "ingress"
from_port = 2049
to_port = 2049
protocol = "tcp"
security_group_id = aws_security_group.efs.id
source_security_group_id = aws_security_group.default.id
}