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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# Variables ====================================================================
variable "name" {
description = "Name for the EFS file system. Applied as a Name tag on all resources."
type = string
}
variable "tags" {
description = "Tags applied to all resources in this module."
type = map(string)
default = {}
}
variable "vpc_id" {
description = "VPC ID in which the EFS security group will be created."
type = string
}
variable "subnet_ids" {
description = "Subnet IDs in which to create EFS mount targets. One per AZ recommended."
type = list(string)
}
variable "allowed_security_group_ids" {
description = "Security group IDs permitted to mount the filesystem (NFS port 2049)."
type = list(string)
default = []
}
# Throughput -------------------------------------------------------------------
variable "performance_mode" {
description = "EFS performance mode: generalPurpose or maxIO."
type = string
default = "generalPurpose"
validation {
condition = contains(["generalPurpose", "maxIO"], var.performance_mode)
error_message = "performance_mode must be 'generalPurpose' or 'maxIO'."
}
}
variable "throughput_mode" {
description = "EFS throughput mode: bursting, provisioned, or elastic."
type = string
default = "elastic"
validation {
condition = contains(["bursting", "provisioned", "elastic"], var.throughput_mode)
error_message = "throughput_mode must be 'bursting', 'provisioned', or 'elastic'."
}
}
variable "provisioned_throughput_mibps" {
description = "Provisioned throughput in MiB/s. Required when throughput_mode is 'provisioned'."
type = number
default = null
}
# Encryption -------------------------------------------------------------------
variable "kms_key_id" {
description = "KMS key ARN for at-rest encryption. Omit to use the AWS-managed key (aws/elasticfilesystem)."
type = string
default = null
}
# Lifecycle --------------------------------------------------------------------
variable "lifecycle_policies" {
description = "Lifecycle policies for transitioning files to EFS-IA and back to primary storage."
type = list(object({
transition_to_ia = optional(string)
transition_to_primary_storage_class = optional(string)
}))
default = [
{ transition_to_ia = "AFTER_30_DAYS" },
{ transition_to_primary_storage_class = "AFTER_1_ACCESS" },
]
}
# Access points ----------------------------------------------------------------
variable "access_points" {
description = "Map of EFS access points to create."
type = map(object({
posix_user_uid = optional(number, 1000)
posix_user_gid = optional(number, 1000)
root_path = string
owner_uid = optional(number, 1000)
owner_gid = optional(number, 1000)
permissions = optional(string, "755")
}))
default = {}
}
# Policy -----------------------------------------------------------------------
variable "policy" {
description = "JSON EFS file system resource policy document. Null disables the policy resource."
type = string
default = null
}
# Replication ------------------------------------------------------------------
variable "replication_destination_region" {
description = "AWS region for EFS replication. Null disables replication."
type = string
default = null
}
|