-
Notifications
You must be signed in to change notification settings - Fork 1
/
efs.tf
69 lines (64 loc) · 2.45 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -------------------------------------------------------------------------------------
#
# Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). All Rights Reserved.
#
# This software is the property of WSO2 LLC. and its suppliers, if any.
# Dissemination of any information or reproduction of any material contained
# herein in any form is strictly forbidden, unless permitted by WSO2 expressly.
# You may not alter or remove any copyright or other notice from copies of this content.
#
# --------------------------------------------------------------------------------------
module "efs" {
source = "git::https://github.com/wso2/aws-terraform-modules.git//modules/aws/EFS?ref=v1.12.0"
count = var.enable_efs_access_point ? 1 : 0
project = var.project
environment = var.environment_name
region = var.region
application = var.client_name
creation_token = var.efs_creation_token
efs_mount_targets = {
"eks_az1_subnet" : {
subnet_id : module.eks_cluster.eks_subnet_ids[0]
security_groups : [module.eks_cluster_efs_access_group.security_group_id]
},
"eks_az2_subnet" : {
subnet_id : module.eks_cluster.eks_subnet_ids[1]
security_groups : [module.eks_cluster_efs_access_group.security_group_id]
}
}
}
module "efs_access_point" {
source = "git::https://github.com/wso2/aws-terraform-modules.git//modules/aws/EFS-Access-Point?ref=v1.12.0"
count = var.enable_efs_access_point ? 1 : 0
file_system_id = module.efs[0].efs_id
posix_user_gid = var.efs_posix_user_gid
posix_user_uid = var.efs_posix_user_uid
permissions = var.efs_permissions
root_directory_path = var.efs_root_directory_path
owner_gid = var.efs_owner_gid
owner_uid = var.efs_owner_uid
tags = var.default_tags
}
module "eks_cluster_efs_access_group" {
source = "git::https://github.com/wso2/aws-terraform-modules.git//modules/aws/Security-Group?ref=v1.12.0"
project = var.project
environment = var.environment_name
region = var.region
application = "${var.client_name}-eks"
description = "Allow Traffic to EFS"
vpc_id = module.vpc.vpc_id
rules = [
{
"direction" : "ingress"
"from_port" : 2049
"to_port" : 2049
"protocol" : "TCP"
"cidr_blocks" : [var.eks_availability_zone_1_subnet_cidr_block, var.eks_availability_zone_2_subnet_cidr_block]
"security_groups" : []
}
]
tags = var.default_tags
depends_on = [
module.vpc
]
}