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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
# Variables ====================================================================
variable "tags" {
description = "Tags applied to all resources in this module."
type = map(string)
default = {}
}
variable "name" {
description = "Name used for the filesystem and derived resource names."
type = string
}
variable "subnet_ids" {
description = <<-EOT
Subnet IDs for the filesystem.
Single-element list for SINGLE_AZ_2. Two-element list (preferred + standby) for MULTI_AZ_1.
EOT
type = list(string)
}
variable "vpc_id" {
description = "VPC ID in which the FSx security group will be created."
type = string
}
variable "allowed_security_group_ids" {
description = "Security group IDs permitted to mount the filesystem (SMB port 445)."
type = list(string)
default = []
}
variable "allowed_cidr_blocks" {
description = "CIDR blocks permitted to mount the filesystem (SMB port 445). Use sparingly — prefer SG references."
type = list(string)
default = []
}
# Storage ----------------------------------------------------------------------
variable "storage_capacity_gb" {
description = "Storage capacity in GiB. Minimum 32 for SSD, 2000 for HDD."
type = number
}
variable "storage_type" {
description = "Storage type: SSD or HDD."
type = string
default = "SSD"
# HDD is only supported with MULTI_AZ_1 and SINGLE_AZ_2 at >= 2000 GiB.
validation {
condition = contains(["SSD", "HDD"], var.storage_type)
error_message = "storage_type must be 'SSD' or 'HDD'."
}
}
variable "throughput_capacity_mbps" {
description = <<-EOT
Throughput capacity in MB/s. Must be one of the FSx-valid values:
8, 16, 32, 64, 128, 256, 512, 1024, 2048.
EOT
type = number
validation {
condition = contains([8, 16, 32, 64, 128, 256, 512, 1024, 2048], var.throughput_capacity_mbps)
error_message = "throughput_capacity_mbps must be one of: 8, 16, 32, 64, 128, 256, 512, 1024, 2048."
}
}
# Deployment -------------------------------------------------------------------
variable "deployment_type" {
description = "FSx deployment type: SINGLE_AZ_2 or MULTI_AZ_1."
type = string
default = "MULTI_AZ_1"
validation {
condition = contains(["SINGLE_AZ_2", "MULTI_AZ_1"], var.deployment_type)
error_message = "deployment_type must be 'SINGLE_AZ_2' or 'MULTI_AZ_1'."
}
}
variable "preferred_subnet_id" {
description = <<-EOT
Preferred subnet ID for the primary file server in MULTI_AZ_1 deployments.
Defaults to the first entry in subnet_ids if not explicitly provided.
Ignored for SINGLE_AZ_2.
EOT
type = string
default = null
}
# Active Directory -------------------------------------------------------------
variable "active_directory" {
description = <<-EOT
Self-managed Active Directory configuration.
Credentials (username, password) must be sourced from Secrets Manager or SSM
by the caller — pass resolved strings, never literals in tfvars.
EOT
type = object({
domain_name = string
dns_ips = list(string)
username = string
password = string
organizational_unit_distinguished_name = optional(string)
file_system_administrators_group = optional(string, "Domain Admins")
})
}
# Encryption -------------------------------------------------------------------
variable "kms_key_id" {
description = "KMS key ARN for at-rest encryption. Omit to use the AWS-managed key (aws/fsx)."
type = string
default = null
}
# Backups ----------------------------------------------------------------------
variable "automatic_backup_retention_days" {
description = "Number of days to retain automatic backups. 0 disables backups."
type = number
default = 7
validation {
condition = var.automatic_backup_retention_days >= 0 && var.automatic_backup_retention_days <= 90
error_message = "automatic_backup_retention_days must be between 0 and 90."
}
}
variable "daily_automatic_backup_start_time" {
description = "Daily backup window in HH:MM format (UTC). Example: '02:00'."
type = string
default = "02:00"
validation {
condition = can(regex("^([01]\\d|2[0-3]):[0-5]\\d$", var.daily_automatic_backup_start_time))
error_message = "daily_automatic_backup_start_time must be in HH:MM format (UTC), e.g. '02:00'."
}
}
variable "copy_tags_to_backups" {
description = "Whether to copy module tags to automatic and manual backups."
type = bool
default = true
}
# Maintenance ------------------------------------------------------------------
variable "weekly_maintenance_start_time" {
description = <<-EOT
Weekly maintenance window in 'd:HH:MM' format (UTC).
d = day of week: 1 (Mon) through 7 (Sun). Example: '7:03:00' = Sunday 03:00 UTC.
EOT
type = string
default = "7:03:00"
validation {
condition = can(regex("^[1-7]:([01]\\d|2[0-3]):[0-5]\\d$", var.weekly_maintenance_start_time))
error_message = "weekly_maintenance_start_time must be in 'd:HH:MM' format, e.g. '7:03:00'."
}
}
# Aliases ----------------------------------------------------------------------
variable "dns_aliases" {
description = "List of DNS alias FQDNs to associate with the filesystem."
type = list(string)
default = []
}
# Audit ------------------------------------------------------------------------
variable "audit_log_destination_arn" {
description = <<-EOT
ARN of the CloudWatch Logs log group or Kinesis Firehose delivery stream
to receive FSx audit logs. Null disables audit logging.
EOT
type = string
default = null
}
variable "file_access_audit_log_level" {
description = "Audit level for file access events: DISABLED, SUCCESS_ONLY, FAILURE_ONLY, SUCCESS_AND_FAILURE."
type = string
default = "DISABLED"
validation {
condition = contains(["DISABLED", "SUCCESS_ONLY", "FAILURE_ONLY", "SUCCESS_AND_FAILURE"], var.file_access_audit_log_level)
error_message = "file_access_audit_log_level must be one of: DISABLED, SUCCESS_ONLY, FAILURE_ONLY, SUCCESS_AND_FAILURE."
}
}
variable "file_share_access_audit_log_level" {
description = "Audit level for file share access events: DISABLED, SUCCESS_ONLY, FAILURE_ONLY, SUCCESS_AND_FAILURE."
type = string
default = "DISABLED"
validation {
condition = contains(["DISABLED", "SUCCESS_ONLY", "FAILURE_ONLY", "SUCCESS_AND_FAILURE"], var.file_share_access_audit_log_level)
error_message = "file_share_access_audit_log_level must be one of: DISABLED, SUCCESS_ONLY, FAILURE_ONLY, SUCCESS_AND_FAILURE."
}
}
|